File tree Expand file tree Collapse file tree 7 files changed +306
-0
lines changed
Expand file tree Collapse file tree 7 files changed +306
-0
lines changed Original file line number Diff line number Diff line change 1+ # GitHub Action that uses Black to reformat the Python code in an incoming pull request.
2+ # If all Python code in the pull request is compliant with Black then this Action does nothing.
3+ # Othewrwise, Black is run and its changes are committed back to the incoming pull request.
4+ # https://github.com/cclauss/autoblack
5+
6+ name : autoblack
7+ on : [pull_request]
8+ jobs :
9+ build :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - uses : actions/checkout@v4
13+ - name : Set up Python 3.11
14+ uses : actions/setup-python@v5
15+ with :
16+ python-version : 3.13
17+ - name : Install click
18+ run : pip install 'click==8.0.4'
19+ - name : Install Black
20+ run : pip install 'black==22.3.0'
21+ - name : Run black --check .
22+ run : black --check .
23+ - name : If needed, commit black changes to the pull request
24+ if : failure()
25+ run : |
26+ black .
27+ git config --global user.name 'autoblack'
28+ git config --global user.email '[email protected] ' 29+ git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
30+ git checkout $GITHUB_HEAD_REF
31+ git commit -am "fixup: Format Python code with Black"
32+ git push
Original file line number Diff line number Diff line change 1+ # GitHub Action that uses Black to reformat the Python code in an incoming pull request.
2+ # If all Python code in the pull request is compliant with Black then this Action does nothing.
3+ # Othewrwise, Black is run and its changes are committed back to the incoming pull request.
4+ # https://github.com/cclauss/autoblack
5+
6+ name : isort and black check
7+ on : [pull_request]
8+ jobs :
9+ build :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - uses : actions/checkout@v4
13+ - name : Set up Python 3.13
14+ uses : actions/setup-python@v5
15+ with :
16+ python-version : 3.13
17+ - name : Install click, black and isort
18+ run : pip install 'click==8.0.4' 'black==23.12.1' 'isort==5.13.2'
19+ - name : Run isort --check .
20+ run : isort --check .
21+ - name : Run black --check .
22+ run : black --check .
23+ # - name: If needed, commit black changes to the pull request
24+ # if: failure()
25+ # run: |
26+ # black .
27+ # git config --global user.name 'autoblack'
28+ # git config --global user.email '[email protected] ' 29+ # git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY
30+ # git checkout $GITHUB_HEAD_REF
31+ # git commit -am "fixup: Format Python code with Black"
32+ # git push
Original file line number Diff line number Diff line change 1+ name : Mathics3 Module PyICU (macOS)
2+
3+ on :
4+ push :
5+ branches : [ master ]
6+ pull_request :
7+ branches : ' **'
8+
9+ jobs :
10+ build :
11+ runs-on : macos-latest
12+ strategy :
13+ matrix :
14+ os : [macOS]
15+ python-version : ['3.12', '3.13']
16+ steps :
17+ - uses : actions/checkout@v4
18+ - name : Set up Python ${{ matrix.python-version }}
19+ uses : actions/setup-python@v5
20+ with :
21+ python-version : ${{ matrix.python-version }}
22+ - name : Install dependencies
23+ run : |
24+ brew install llvm
25+ python -m pip install --upgrade pip
26+ python -m pip install pytest
27+ # # Go over and comment out stuff when next Mathics core and Mathics-scanner are released
28+ # python -m pip install -e git+https://github.com/Mathics3/mathics-scanner#egg=Mathics-Scanner[full]
29+ # git clone https://github.com/Mathics3/mathics-core
30+ # (cd mathics-core && pip3 install -e .[full])
31+ # (cd mathics-core && bash ./admin-tools/make-JSON-tables.sh)
32+ # python -m pip install -e git+https://github.com/Mathics3/Mathics3-Module-Base#egg=Mathics3-Module-Base
33+ - name : Install Mathic3 PyICU Module
34+ run : |
35+ python -m pip install Mathics3
36+ python -m pip install --no-build-isolation -e .
37+ - name : Test Mathics3 Module PyICU
38+ run : |
39+ make check
Original file line number Diff line number Diff line change 1+ name : Mathics3-Module-pyICU (ubuntu)
2+
3+ on :
4+ push :
5+ branches : [ master ]
6+ pull_request :
7+ branches : ' **'
8+
9+ jobs :
10+ build :
11+ runs-on : ubuntu-latest
12+ strategy :
13+ matrix :
14+ python-version : ['3.12', '3.13']
15+ steps :
16+ - uses : actions/checkout@v4
17+ - name : Set up Python ${{ matrix.python-version }}
18+ uses : actions/setup-python@v5
19+ with :
20+ python-version : ${{ matrix.python-version }}
21+ - name : Install dependencies
22+ run : |
23+ python -m pip install --upgrade pip
24+ python -m pip install pytest
25+ # # Go over and comment out stuff when next Mathics core and Mathics-scanner are released
26+ # python -m pip install -e git+https://github.com/Mathics3/mathics-scanner#egg=Mathics-Scanner[full]
27+ # git clone https://github.com/Mathics3/mathics-core
28+ # (cd mathics-core && pip3 install -e .[full])
29+ # (cd mathics-core && bash ./admin-tools/make-JSON-tables.sh)
30+ # python -m pip install -e git+https://github.com/Mathics3/Mathics3-Module-Base#egg=Mathics3-Module-Base
31+ - name : install Mathic3 PyICU Module
32+ run : |
33+ python -m pip install Mathics3
34+ python -m pip install --no-build-isolation -e .
35+ - name : Test Mathics3 PyICU Module
36+ run : |
37+ make check
Original file line number Diff line number Diff line change 1+ name : Mathics3-Module-PyICU (MS Windows)
2+
3+ on :
4+ push :
5+ branches : [ master ]
6+ pull_request :
7+ branches : ' **'
8+
9+ jobs :
10+ build :
11+ runs-on : windows-latest
12+ strategy :
13+ matrix :
14+ os : [windows]
15+ python-version : ['3.12', '3.13']
16+ steps :
17+ - uses : actions/checkout@v4
18+ - name : Set up Python ${{ matrix.python-version }}
19+ uses : actions/setup-python@v5
20+ with :
21+ python-version : ${{ matrix.python-version }}
22+ - name : Install dependencies
23+ run : |
24+ python -m pip install --upgrade pip
25+ python -m pip install pytest
26+ # python -m pip install -e git+https://github.com/Mathics3/mathics-scanner#egg=Mathics-Scanner
27+ # git clone --depth 1 https://github.com/Mathics3/mathics-core mathics-core
28+ # cd mathics-core
29+ # python -m pip install -e .
30+ # bash admin-tools/make-JSON-tables.sh
31+ # cd ..
32+ # python -m pip install -e git+https://github.com/Mathics3/Mathics3-Module-Base#egg=Mathics3-Module-Base
33+ - name : Install Mathic3 PyICU Module
34+ run : |
35+ python -m pip install Mathics3
36+ python -m pip install --no-build-isolation -e .
37+ - name : Test Mathics
38+ run : |
39+ make check
Original file line number Diff line number Diff line change 1+ # A GNU Makefile to run various tasks - compatibility for us old-timers.
2+
3+ # Note: This makefile include remake-style target comments.
4+ # These comments before the targets start with #:
5+ # remake --tasks to shows the targets and the comments
6+
7+ GIT2CL ?= admin-tools/git2cl
8+ PYTHON ?= python3
9+ PIP ?= pip3
10+ RM ?= rm
11+ LANG = en
12+
13+ .PHONY : all build \
14+ check clean \
15+ develop dist doc doc-data \
16+ pypi-setup \
17+ pytest \
18+ rmChangeLog \
19+ test
20+
21+ # : Default target - same as "develop"
22+ all : develop
23+
24+ # : build everything needed to install
25+ build :
26+ $(PYTHON ) ./setup.py build
27+
28+ # : Make PyPI distribution
29+ dist :
30+ ./admin-tools/make-dist.sh
31+
32+ # : Check Python version, and install PyPI dependencies
33+ pypi-setup :
34+ $(PIP ) install -e .
35+
36+ # : Set up to run from the source tree
37+ develop : pypi-setup
38+ $(PIP ) install -e .
39+
40+ # Run tests
41+ check : pytest
42+
43+ # : Remove derived files
44+ clean : clean-pyc
45+
46+ # : Remove old PYC files
47+ clean-pyc :
48+ @find . -name " *.pyc" -type f -delete
49+
50+ # : Run py.test tests. Use environment variable "o" for pytest options
51+ pytest :
52+ pytest test $o
53+
54+
55+ # #: Make Mathics PDF manual
56+ # doc mathics.pdf: mathics/doc/tex/data
57+ # (cd mathics/doc/tex && $(MAKE) mathics.pdf)
58+
59+ # : Remove ChangeLog
60+ rmChangeLog :
61+ $(RM ) ChangeLog || true
62+
63+ # : Create a ChangeLog from git via git log and git2cl
64+ ChangeLog : rmChangeLog
65+ git log --pretty --numstat --summary | $(GIT2CL ) > $@
66+ patch ChangeLog < ChangeLog-spell-corrected.diff
Original file line number Diff line number Diff line change 1+ # -*- coding: utf-8 -*-
2+
3+ from mathics .core .load_builtin import import_and_load_builtins
4+ from mathics .session import MathicsSession
5+
6+ import_and_load_builtins ()
7+
8+ session = MathicsSession (character_encoding = "UTF-8" )
9+
10+
11+ def check_evaluation (str_expr : str , expected : str , assert_message = "" ):
12+ """Helper function to test that a Mathics expression against
13+ its results"""
14+ result = session .evaluate (str_expr ).value
15+
16+ if assert_message :
17+ assert result == expected , f"{ assert_message } : got: { result } "
18+ else :
19+ assert result == expected
20+
21+
22+ def test_language ():
23+ session .evaluate ('LoadModule["pymathics.language"]' ) == "pymathics.language"
24+ check_evaluation (
25+ 'Alphabet["es"]' ,
26+ (
27+ "a" ,
28+ "b" ,
29+ "c" ,
30+ "d" ,
31+ "e" ,
32+ "f" ,
33+ "g" ,
34+ "h" ,
35+ "i" ,
36+ "j" ,
37+ "k" ,
38+ "l" ,
39+ "m" ,
40+ "n" ,
41+ "o" ,
42+ "p" ,
43+ "q" ,
44+ "r" ,
45+ "s" ,
46+ "t" ,
47+ "u" ,
48+ "v" ,
49+ "w" ,
50+ "x" ,
51+ "y" ,
52+ "z" ,
53+ "á" ,
54+ "é" ,
55+ "í" ,
56+ "ñ" ,
57+ "ó" ,
58+ "ú" ,
59+ "ü" ,
60+ ),
61+ )
You can’t perform that action at this time.
0 commit comments