Skip to content

Commit

Permalink
sagemathgh-38029: Fix interaction of # 32-bit / # 64-bit tag with blo…
Browse files Browse the repository at this point in the history
…ck-scoped doctest tags

    
<!-- ^ Please provide a concise and informative title. -->
<!-- ^ Don't put issue numbers in the title, do this in the PR
description below. -->
<!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method
to calculate 1 + 2". -->
<!-- v Describe your changes below in detail. -->
<!-- v Why is this change required? What problem does it solve? -->
<!-- v If this PR resolves an open issue, please link to it here. For
example, "Fixes sagemath#12345". -->

- Fixes sagemath#36099

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [ ] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion.
- [ ] I have created tests covering the changes.
- [ ] I have updated the documentation and checked the documentation
preview.

### ⌛ Dependencies

<!-- List all open PRs that this PR logically depends on. For example,
-->
<!-- - sagemath#12345: short description why this is a dependency -->
<!-- - sagemath#34567: ... -->
    
URL: sagemath#38029
Reported by: Matthias Köppe
Reviewer(s):
  • Loading branch information
Release Manager committed May 29, 2024
2 parents dfebbe7 + 316c6f7 commit 6ccce61
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 6ccce61

Please sign in to comment.