Skip to content

Commit f9db6f2

Browse files
Add load_default_settings_files function
1 parent 6cb239a commit f9db6f2

File tree

2 files changed

+35
-16
lines changed

2 files changed

+35
-16
lines changed

mathicsscript/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,15 @@
55
Copyright 2020-2021 The Mathics Team
66
"""
77
from mathicsscript.version import __version__
8+
9+
10+
def load_default_settings_files(definitions):
11+
import os.path as osp
12+
from mathics.core.definitions import autoload_files
13+
14+
root_dir = osp.realpath(osp.dirname(__file__))
15+
16+
autoload_files(definitions, root_dir, "autoload")
17+
18+
19+
__all__ = [__version__, load_default_settings_files]

test/test_settings.py

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,44 @@
11
# -*- coding: utf-8 -*-
22
from .helper import session
33

4-
import os.path as osp
4+
from mathicsscript import load_default_settings_files
55

6-
from mathics.core.definitions import autoload_files, Definitions
76

87
def test_settings():
9-
import os.path as osp
10-
from mathics.core.definitions import autoload_files
11-
import mathicsscript
8+
load_default_settings_files(session.definitions)
129

13-
root_dir = osp.realpath(
14-
osp.dirname(mathicsscript.__file__),
10+
assert (
11+
session.evaluate("Settings`$ShowFullFormInput::usage").to_python()
12+
!= "Settings`$ShowFullFormInput::usage"
1513
)
1614

17-
autoload_files(session.definitions, root_dir, "autoload")
18-
19-
assert session.evaluate("Settings`$ShowFullFormInput::usage").to_python() != "Settings`$ShowFullFormInput::usage"
20-
2115
assert type(session.evaluate("Settings`$ShowFullFormInput").to_python()) is bool
2216

23-
assert session.evaluate("Settings`$PygmentsStyle::usage").to_python() != "Settings`$PygmentsStyle::usage"
17+
assert (
18+
session.evaluate("Settings`$PygmentsStyle::usage").to_python()
19+
!= "Settings`$PygmentsStyle::usage"
20+
)
2421

25-
assert session.evaluate("Settings`$PygmentsShowTokens::usage").to_python() != "Settings`$PygmentsShowTokens::usage"
22+
assert (
23+
session.evaluate("Settings`$PygmentsShowTokens::usage").to_python()
24+
!= "Settings`$PygmentsShowTokens::usage"
25+
)
2626

2727
assert type(session.evaluate("Settings`$PygmentsShowTokens").to_python()) is bool
2828

29-
assert session.evaluate("Settings`$UseUnicode::usage").to_python() != "Settings`$UseUnicode::usage"
29+
assert (
30+
session.evaluate("Settings`$UseUnicode::usage").to_python()
31+
!= "Settings`$UseUnicode::usage"
32+
)
3033

3134
assert type(session.evaluate("Settings`$UseUnicode").to_python()) is bool
3235

33-
assert session.evaluate("Settings`MathicsScriptVersion::usage").to_python() != "Settings`MathicsScriptVersion::usage"
36+
assert (
37+
session.evaluate("Settings`MathicsScriptVersion::usage").to_python()
38+
!= "Settings`MathicsScriptVersion::usage"
39+
)
40+
3441

3542
def test_is_not_notebook():
36-
# the settings already were loaded
43+
# the settings already were loaded
3744
assert session.evaluate("System`$Notebooks").to_python() == False

0 commit comments

Comments
 (0)