Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions mathics/builtin/files_io/importexport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
14 changes: 8 additions & 6 deletions mathics/doc/doc_entries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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*([:|=])(.*)$")
Expand Down Expand Up @@ -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 <dl>...</dl>
# doc = DL_RE.sub("", doc)
doc = filter_comments(doc)

# pre-substitute Python code because it might contain tests
doc, post_substitutions = pre_sub(
Expand Down Expand Up @@ -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
Expand Down