diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 5bdcf7d0e..936886042 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -15,7 +15,7 @@ jobs: strategy: matrix: os: [macOS] - python-version: ['3.10', '3.11'] + python-version: ['3.13', '3.12'] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index d886d5b64..ee770cba9 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.12', '3.11', '3.8', '3.9', '3.10'] + python-version: ['3.13', '3.12', '3.11', '3.10', '3.9'] steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} diff --git a/mathics/builtin/files_io/importexport.py b/mathics/builtin/files_io/importexport.py index e91f20179..9b0033230 100644 --- a/mathics/builtin/files_io/importexport.py +++ b/mathics/builtin/files_io/importexport.py @@ -1060,16 +1060,16 @@ class RegisterImport(Builtin): >> FilePrint["ExampleData/ExampleData.txt"] | Example File Format | Created by Angus - | 0.629452 0.586355 - | 0.711009 0.687453 - | 0.246540 0.433973 - | 0.926871 0.887255 - | 0.825141 0.940900 - | 0.847035 0.127464 - | 0.054348 0.296494 - | 0.838545 0.247025 - | 0.838697 0.436220 - | 0.309496 0.833591 + | 0.629452 0.586355 + | 0.711009 0.687453 + | 0.246540 0.433973 + | 0.926871 0.887255 + | 0.825141 0.940900 + | 0.847035 0.127464 + | 0.054348 0.296494 + | 0.838545 0.247025 + | 0.838697 0.436220 + | 0.309496 0.833591 >> Import["ExampleData/ExampleData.txt", {"ExampleFormat1", "Elements"}] = {Data, Header} diff --git a/mathics/core/builtin.py b/mathics/core/builtin.py index 269300b2d..4450f70bb 100644 --- a/mathics/core/builtin.py +++ b/mathics/core/builtin.py @@ -468,6 +468,8 @@ def get_functions(self, prefix="eval", is_pymodule=False): for name in dir(self): if name.startswith(prefix): function = getattr(self, name) + if not hasattr(function, "__call__"): + continue pattern = function.__doc__ if pattern is None: # Fixes PyPy bug continue diff --git a/mathics/doc/doc_entries.py b/mathics/doc/doc_entries.py index 201d4ae19..e91d88af7 100644 --- a/mathics/doc/doc_entries.py +++ b/mathics/doc/doc_entries.py @@ -93,7 +93,7 @@ r"""(?mx)^ # re.MULTILINE (multi-line match) # and re.VERBOSE (readable regular expressions ((?:.|\n)*?) - ^\s+([>#SX])>[ ](.*) # test-code indicator + ^\s*([>#SX])>[ ](.*) # test-code indicator ((?:\n\s*(?:[:|=.][ ]|\.).*)*) # test-code results""" ) TESTCASE_OUT_RE = re.compile(r"^\s*([:|=])(.*)$") @@ -216,10 +216,7 @@ def parse_docstring_to_DocumentationEntry_items( logging.warning("``key_part`` is deprecated. Its value is discarded.") # Remove commented lines. - doc = filter_comments(doc).strip(r"\s") - - # Remove leading
...
- # doc = DL_RE.sub("", doc) + doc = filter_comments(doc) # .strip("\s") # pre-substitute Python code because it might contain tests doc, post_substitutions = pre_sub( @@ -394,11 +391,16 @@ def compare_out(self, outs: tuple = tuple()) -> bool: # Mismatched number of output lines, and we don't have "..." return False + # Python 3.13 replaces tabs by a single space in docstrings. + # In doctests we replace tabs by sequences of four spaces. + def tabs_to_spaces(val): + return val.text.replace("\t", 4 * " ") + # Need to check all output line by line for got, wanted in zip(outs, wanted_outs): if wanted.text == "...": return True - if not got == wanted: + if not tabs_to_spaces(got) == tabs_to_spaces(wanted): return False return True