Skip to content

Commit

Permalink
src/sage/doctest/sources.py: Fix # 32-bit / # 64-bit tag in block-sco…
Browse files Browse the repository at this point in the history
…ped doctest tags
  • Loading branch information
Matthias Koeppe committed May 19, 2024
1 parent ffbbea9 commit b50f5b4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/sage/doctest/sources.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
find_prompt = re.compile(r"^(\s*)(>>>|sage:)(.*)")

# For testing that enough doctests are created
sagestart = re.compile(r"^\s*(>>> |sage: )\s*[^#\s]")
sagestart = re.compile(r"^(\s*(>>> |sage: ))\s*[^#\s]")
untested = re.compile("(not implemented|not tested)")

# For parsing a PEP 0263 encoding declaration
Expand Down Expand Up @@ -331,9 +331,11 @@ def _create_doctests(self, namespace, tab_okay=None):
continue
else:
line = line[:bitness.start()] + "\n"
if self.line_shift and sagestart.match(line):
# We insert blank lines to make up for the removed lines
doc.extend(["\n"]*self.line_shift)
if self.line_shift and (m := sagestart.match(line)):
# We insert empty doctest lines to make up for the removed lines
indent_and_prompt = m.group(1)
doc.extend([indent_and_prompt + "# inserted to compensate for removed conditional doctest output\n"]
* self.line_shift)
self.line_shift = 0
doc.append(line)
unparsed_doc = True
Expand Down

0 comments on commit b50f5b4

Please sign in to comment.