Skip to content

Commit 6cb239a

Browse files
Improve test_settings
1 parent f0e4d28 commit 6cb239a

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

test/test_settings.py

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,32 @@
66
from mathics.core.definitions import autoload_files, Definitions
77

88
def test_settings():
9-
for setting in (
10-
"Settings`$ShowFullFormInput::usage",
11-
"Settings`$ShowFullFormInput",
12-
"Settings`$PygmentsStyle::usage",
13-
"Settings`$PygmentsShowTokens::usage",
14-
"Settings`$PygmentsShowTokens",
15-
"Settings`$UseUnicode::usage",
16-
"Settings`$UseUnicode",
17-
"Settings`MathicsScriptVersion::usage",
18-
"System`$Notebooks",
19-
"System`$Notebooks::usage",
20-
):
21-
assert session.evaluate(setting), setting
22-
23-
def test_is_not_notebook():
249
import os.path as osp
2510
from mathics.core.definitions import autoload_files
11+
import mathicsscript
2612

27-
root_dir = osp.realpath(osp.join(
28-
osp.dirname(osp.abspath(__file__)),
29-
"..",
30-
"mathicsscript",
31-
))
13+
root_dir = osp.realpath(
14+
osp.dirname(mathicsscript.__file__),
15+
)
3216

3317
autoload_files(session.definitions, root_dir, "autoload")
3418

19+
assert session.evaluate("Settings`$ShowFullFormInput::usage").to_python() != "Settings`$ShowFullFormInput::usage"
20+
21+
assert type(session.evaluate("Settings`$ShowFullFormInput").to_python()) is bool
22+
23+
assert session.evaluate("Settings`$PygmentsStyle::usage").to_python() != "Settings`$PygmentsStyle::usage"
24+
25+
assert session.evaluate("Settings`$PygmentsShowTokens::usage").to_python() != "Settings`$PygmentsShowTokens::usage"
26+
27+
assert type(session.evaluate("Settings`$PygmentsShowTokens").to_python()) is bool
28+
29+
assert session.evaluate("Settings`$UseUnicode::usage").to_python() != "Settings`$UseUnicode::usage"
30+
31+
assert type(session.evaluate("Settings`$UseUnicode").to_python()) is bool
32+
33+
assert session.evaluate("Settings`MathicsScriptVersion::usage").to_python() != "Settings`MathicsScriptVersion::usage"
34+
35+
def test_is_not_notebook():
36+
# the settings already were loaded
3537
assert session.evaluate("System`$Notebooks").to_python() == False

0 commit comments

Comments
 (0)