Skip to content

Commit

Permalink
Add load_default_settings_files function
Browse files Browse the repository at this point in the history
  • Loading branch information
TiagoCavalcante committed Jun 23, 2021
1 parent 6cb239a commit f9db6f2
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 16 deletions.
12 changes: 12 additions & 0 deletions mathicsscript/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,15 @@
Copyright 2020-2021 The Mathics Team
"""
from mathicsscript.version import __version__


def load_default_settings_files(definitions):
import os.path as osp
from mathics.core.definitions import autoload_files

root_dir = osp.realpath(osp.dirname(__file__))

autoload_files(definitions, root_dir, "autoload")


__all__ = [__version__, load_default_settings_files]
39 changes: 23 additions & 16 deletions test/test_settings.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,44 @@
# -*- coding: utf-8 -*-
from .helper import session

import os.path as osp
from mathicsscript import load_default_settings_files

from mathics.core.definitions import autoload_files, Definitions

def test_settings():
import os.path as osp
from mathics.core.definitions import autoload_files
import mathicsscript
load_default_settings_files(session.definitions)

root_dir = osp.realpath(
osp.dirname(mathicsscript.__file__),
assert (
session.evaluate("Settings`$ShowFullFormInput::usage").to_python()
!= "Settings`$ShowFullFormInput::usage"
)

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

assert session.evaluate("Settings`$ShowFullFormInput::usage").to_python() != "Settings`$ShowFullFormInput::usage"

assert type(session.evaluate("Settings`$ShowFullFormInput").to_python()) is bool

assert session.evaluate("Settings`$PygmentsStyle::usage").to_python() != "Settings`$PygmentsStyle::usage"
assert (
session.evaluate("Settings`$PygmentsStyle::usage").to_python()
!= "Settings`$PygmentsStyle::usage"
)

assert session.evaluate("Settings`$PygmentsShowTokens::usage").to_python() != "Settings`$PygmentsShowTokens::usage"
assert (
session.evaluate("Settings`$PygmentsShowTokens::usage").to_python()
!= "Settings`$PygmentsShowTokens::usage"
)

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

assert session.evaluate("Settings`$UseUnicode::usage").to_python() != "Settings`$UseUnicode::usage"
assert (
session.evaluate("Settings`$UseUnicode::usage").to_python()
!= "Settings`$UseUnicode::usage"
)

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

assert session.evaluate("Settings`MathicsScriptVersion::usage").to_python() != "Settings`MathicsScriptVersion::usage"
assert (
session.evaluate("Settings`MathicsScriptVersion::usage").to_python()
!= "Settings`MathicsScriptVersion::usage"
)


def test_is_not_notebook():
# the settings already were loaded
# the settings already were loaded
assert session.evaluate("System`$Notebooks").to_python() == False

0 comments on commit f9db6f2

Please sign in to comment.