Skip to content

Commit 5340692

Browse files
author
Release Manager
committed
gh-36034: Fix block-scoped doctest tags with `\` line continuations <!-- ^^^^^ Please provide a concise, informative and self-explanatory title. Don't put issue numbers in there, do this in the PR body below. For example, instead of "Fixes #1234" use "Introduce new method to calculate 1+1" --> <!-- Describe your changes here in detail --> <!-- Why is this change required? What problem does it solve? --> Fixes #36033 (comment) <!-- If this PR resolves an open issue, please link to it here. For example "Fixes #12345". --> <!-- If your change requires a documentation PR, please link it appropriately. --> ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> <!-- If your change requires a documentation PR, please link it appropriately --> <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> <!-- Feel free to remove irrelevant items. --> - [x] The title is concise, informative, and self-explanatory. - [ ] 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 accordingly. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on - #12345: short description why this is a dependency - #34567: ... --> - Depends on #36025 (merged here) <!-- If you're unsure about any of these, don't hesitate to ask. We're here to help! --> URL: #36034 Reported by: Matthias Köppe Reviewer(s): Kwankyu Lee, Matthias Köppe
2 parents e8453e1 + 669065a commit 5340692

File tree

6 files changed

+33
-19
lines changed

6 files changed

+33
-19
lines changed

src/sage/coding/code_constructions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,8 +732,7 @@ def ToricCode(P,F):
732732
sage: C.minimum_distance()
733733
24
734734
sage: C.minimum_distance(algorithm="guava") # optional - gap_package_guava
735-
...
736-
24
735+
...24
737736
sage: C = codes.ToricCode([[-2,-2],[-1,-2],[-1,-1],[-1,0],
738737
....: [0,-1],[0,0],[0,1],[1,-1],[1,0]], GF(5))
739738
sage: C

src/sage/coding/linear_code.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -911,8 +911,7 @@ def covering_radius(self):
911911
912912
sage: C = codes.HammingCode(GF(2), 5)
913913
sage: C.covering_radius() # optional - gap_package_guava
914-
...
915-
1
914+
...1
916915
917916
sage: C = codes.random_linear_code(GF(263), 5, 1)
918917
sage: C.covering_radius() # optional - gap_package_guava
@@ -1375,8 +1374,7 @@ def minimum_distance(self, algorithm=None):
13751374
3
13761375
sage: libgap.SetAllInfoLevels(0) # to suppress extra info messages # optional - sage.libs.gap
13771376
sage: C.minimum_distance(algorithm="guava") # optional - gap_package_guava
1378-
...
1379-
3
1377+
...3
13801378
13811379
TESTS::
13821380

src/sage/doctest/parsing.py

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,14 +1071,36 @@ def parse(self, string, *args):
10711071
'',
10721072
(None, '5 # optional guava\n', 'Integer(5) # optional guava\n'),
10731073
'']
1074+
1075+
TESTS::
1076+
1077+
sage: parse("::\n\n sage: # needs sage.combinat\n sage: from sage.geometry.polyhedron.combinatorial_polyhedron.conversions \\\n ....: import incidence_matrix_to_bit_rep_of_Vrep\n sage: P = polytopes.associahedron(['A',3])\n\n")
1078+
['::\n\n',
1079+
'',
1080+
(None,
1081+
'from sage.geometry.polyhedron.combinatorial_polyhedron.conversions import incidence_matrix_to_bit_rep_of_Vrep\n',
1082+
'from sage.geometry.polyhedron.combinatorial_polyhedron.conversions import incidence_matrix_to_bit_rep_of_Vrep\n'),
1083+
'',
1084+
(None,
1085+
"P = polytopes.associahedron(['A',3])\n",
1086+
"P = polytopes.associahedron(['A',Integer(3)])\n"),
1087+
'\n']
1088+
1089+
sage: example4 = '::\n\n sage: C.minimum_distance(algorithm="guava") # optional - guava\n ...\n 24\n\n'
1090+
sage: parsed4 = DTP.parse(example4)
1091+
sage: dte = parsed4[1]
1092+
sage: dte.sage_source
1093+
'C.minimum_distance(algorithm="guava") # optional - guava\n'
1094+
sage: dte.want
1095+
'...\n24\n'
10741096
"""
10751097
# Regular expressions
10761098
find_sage_prompt = re.compile(r"^(\s*)sage: ", re.M)
10771099
find_sage_continuation = re.compile(r"^(\s*)\.\.\.\.:", re.M)
10781100
find_python_continuation = re.compile(r"^(\s*)\.\.\.([^\.])", re.M)
10791101
python_prompt = re.compile(r"^(\s*)>>>", re.M)
10801102
backslash_replacer = re.compile(r"""(\s*)sage:(.*)\\\ *
1081-
\ *(((\.){4}:)|((\.){3}))?\ *""")
1103+
\ *((\.){4}:)?\ *""")
10821104

10831105
# The following are used to allow ... at the beginning of output
10841106
ellipsis_tag = "<TEMP_ELLIPSIS_TAG>"
@@ -1087,13 +1109,8 @@ def parse(self, string, *args):
10871109
# doctest system.
10881110
m = backslash_replacer.search(string)
10891111
while m is not None:
1090-
next_prompt = find_sage_prompt.search(string, m.end())
10911112
g = m.groups()
1092-
if next_prompt:
1093-
future = string[m.end():next_prompt.start()] + '\n' + string[next_prompt.start():]
1094-
else:
1095-
future = string[m.end():]
1096-
string = string[:m.start()] + g[0] + "sage:" + g[1] + future
1113+
string = string[:m.start()] + g[0] + "sage:" + g[1] + string[m.end():]
10971114
m = backslash_replacer.search(string, m.start())
10981115

10991116
replace_ellipsis = not python_prompt.search(string)

src/sage/dynamics/arithmetic_dynamics/wehlerK3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def Qxa(self, a):
474474
sage: Z = x0^2*y0^2 + 3*x0*x1*y0^2 + x1^2*y0^2 + 4*x0^2*y0*y1 + 3*x0*x1*y0*y1 \
475475
- 2*x2^2*y0*y1 - x0^2*y1^2 + 2*x1^2*y1^2 - x0*x2*y1^2 - 4*x1*x2*y1^2 \
476476
+ 5*x0*x2*y0*y2 \
477-
- 4*x1*x2*y0*y2 + 7*x0^2*y1*y2 + 4*x1^2*y1*y2 + x0*x1*y2^2 + 3*x2^2*y2^2 \
477+
- 4*x1*x2*y0*y2 + 7*x0^2*y1*y2 + 4*x1^2*y1*y2 + x0*x1*y2^2 + 3*x2^2*y2^2
478478
sage: Y = x0*y0 + x1*y1 + x2*y2
479479
sage: X = WehlerK3Surface([Z, Y])
480480
sage: T = PP(1, 1, 0, 1, 0, 0)

src/sage/symbolic/expression.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ Check that :trac:`9880` is fixed::
238238
11/27*b_0/((2^b_2)^2*(2^b_1)^2*(2^b_0)^2) - \
239239
11/27*b_1/((2^b_2)^2*(2^b_1)^2*(2^b_0)^2) - \
240240
11/27*b_2/((2^b_2)^2*(2^b_1)^2*(2^b_0)^2) + \
241-
64/81/((2^b_2)^2*(2^b_1)^2*(2^b_0)^2) + 35/81 \
241+
64/81/((2^b_2)^2*(2^b_1)^2*(2^b_0)^2) + 35/81
242242
sage: f.nops()
243243
38
244244

src/sage/tests/book_stein_ent.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121
sage: factor(31415926535898)
2222
2 * 3 * 53 * 73 * 2531 * 534697
2323
sage: n = 7403756347956171282804679609742957314259318888\
24-
...9231289084936232638972765034028266276891996419625117\
25-
...8439958943305021275853701189680982867331732731089309\
26-
...0055250511687706329907239638078671008609696253793465\
27-
...0563796359
24+
....: 9231289084936232638972765034028266276891996419625117\
25+
....: 8439958943305021275853701189680982867331732731089309\
26+
....: 0055250511687706329907239638078671008609696253793465\
27+
....: 0563796359
2828
sage: len(n.str(2))
2929
704
3030
sage: len(n.str(10))

0 commit comments

Comments
 (0)