Skip to content

Commit 2354db9

Browse files
committed
Adminsitriva
Add doctest testing to "make check" Go over and update precommit hooks Go over doc examples.
1 parent 28a1820 commit 2354db9

File tree

5 files changed

+25
-25
lines changed

5 files changed

+25
-25
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/ChangeLog-spell-corrected
55
/ChangeLog.orig
66
/Mathics3_Module_hello.egg-info
7+
/Mathics3_hello.egg-info
78
/build
89
/dist
910
/tmp

.pre-commit-config.yaml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,24 @@ default_language_version:
22
python: python
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.0.1
5+
rev: v4.5.0
66
hooks:
77
- id: check-merge-conflict
88
- id: debug-statements
99
stages: [pre-commit]
10+
exclude: ChangeLog-spell-corrected.diff
1011
- id: end-of-file-fixer
1112
stages: [pre-commit]
12-
# - repo: https://github.com/pycqa/isort
13-
# rev: 5.10.1
14-
# hooks:
15-
# - id: isort
16-
# stages: [commit]
13+
exclude: ChangeLog-spell-corrected.diff
14+
- repo: https://github.com/pycqa/isort
15+
rev: 5.13.2
16+
hooks:
17+
- id: isort
18+
stages: [pre-commit]
1719
- repo: https://github.com/psf/black
18-
rev: 22.3.0
20+
rev: 23.12.1
1921
hooks:
2022
- id: black
2123
language_version: python3
2224
exclude: 'pymathics/hello/version.py'
2325
stages: [pre-commit]
24-
- repo: https://github.com/pycqa/flake8
25-
rev: 3.9.2
26-
hooks:
27-
- id: flake8
28-
stages: [pre-commit]

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LANG = en
1616
pypi-setup \
1717
pytest \
1818
rmChangeLog \
19-
test
19+
doctest pytest test
2020

2121
#: Default target - same as "develop"
2222
all: develop
@@ -38,7 +38,7 @@ install:
3838
$(PYTHON) setup.py install
3939

4040
# Run tests
41-
check: pytest
41+
check: pytest doctest
4242

4343
#: Remove derived files
4444
clean: clean-pyc
@@ -47,11 +47,15 @@ clean: clean-pyc
4747
clean-pyc:
4848
@find . -name "*.pyc" -type f -delete
4949

50+
#:
51+
doctest:
52+
MATHICS_CHARACTER_ENCODING="ASCII" $(PYTHON) -m mathics.docpipeline -l pymathics.hello -c 'Example Mathics3 Module' $o
5053
#: Run py.test tests. Use environment variable "o" for pytest options
5154
pytest:
5255
py.test test $o
5356

5457

58+
5559
# #: Make Mathics PDF manual
5660
# doc mathics.pdf: mathics/doc/tex/data
5761
# (cd mathics/doc/tex && $(MAKE) mathics.pdf)

pymathics/hello/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# -*- coding: utf-8 -*-
22
"""
3-
PyMathics Hello test module.
3+
Example Mathics3 Module
44
5-
This is an example of an external PyMathics module.
5+
This is an example of an external Mathics3 Module.
66
7-
A PyMathics module is a Python module which can be loaded into Mathics using the
7+
A Mathics3 Module is a Python module which can be loaded into Mathics using the
88
``LoadModule[]`` method.
99
1010
In particular, to load this after installing this module as a Python module run inside
@@ -27,8 +27,8 @@
2727
2828
"""
2929

30-
from pymathics.hello.version import __version__
3130
from pymathics.hello.__main__ import Hello
31+
from pymathics.hello.version import __version__
3232

3333
__all__ = ("__version__", "Hello", "pymathics_version_data")
3434

pymathics/hello/__main__.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,16 @@ class Hello(Builtin):
1212
<dd>An example function in a Python-importable Mathics3 module.
1313
</dl>
1414
15-
>> PyMathics`Hello["World"]
15+
>> Hello[]
16+
= "Hello, World!"
17+
18+
>> Hello["Everyone"]
19+
= Hello, "Everyone!"
1620
1721
See also the <url>
1822
:developer guide section:
1923
https://mathics-development-guide.readthedocs.io/en/latest/extending/developing-code/extending/tutorial/1-builtin.html</url> for an \
2024
explanation of everything.
21-
22-
>> Hello[]
23-
= Hello, World!
24-
25-
>> Hello["rocky"]
26-
= Hello, rocky!
2725
"""
2826

2927
summary_text = """classic "hello" demo"""

0 commit comments

Comments
 (0)