Skip to content

Commit

Permalink
gh-39187: Fix tests output for Python 3.13
Browse files Browse the repository at this point in the history
    
Mostly caused by leading spaces being stripped in docs printing, and
suggestions being offered for incorrect keywords.
    
URL: #39187
Reported by: Antonio Rojas
Reviewer(s): Tobias Diez
  • Loading branch information
Release Manager committed Jan 2, 2025
2 parents 2080c58 + fd10889 commit dbdc77f
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/doc/de/tutorial/tour_linalg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -241,4 +241,4 @@ Beachten Sie, dass Python zwischen Klein- und Großschreibung unterscheidet:
sage: M = MatrixSpace(QQ, 10,10, Sparse=True)
Traceback (most recent call last):
...
TypeError: ...__init__() got an unexpected keyword argument 'Sparse'
TypeError: ...__init__() got an unexpected keyword argument 'Sparse'...
2 changes: 1 addition & 1 deletion src/doc/en/tutorial/tour_linalg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -235,4 +235,4 @@ Note that Python is case sensitive:
sage: M = MatrixSpace(QQ, 10,10, Sparse=True)
Traceback (most recent call last):
...
TypeError: ...__init__() got an unexpected keyword argument 'Sparse'
TypeError: ...__init__() got an unexpected keyword argument 'Sparse'...
2 changes: 1 addition & 1 deletion src/doc/fr/tutorial/tour_linalg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -237,4 +237,4 @@ Notez que Python distingue les majuscules des minuscules :
sage: M = MatrixSpace(QQ, 10,10, Sparse=True)
Traceback (most recent call last):
...
TypeError: ...__init__() got an unexpected keyword argument 'Sparse'
TypeError: ...__init__() got an unexpected keyword argument 'Sparse'...
2 changes: 1 addition & 1 deletion src/doc/ja/tutorial/tour_linalg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -248,4 +248,4 @@ Pythonでは,大文字小文字が区別されることに注意:
sage: M = MatrixSpace(QQ, 10,10, Sparse=True)
Traceback (most recent call last):
...
TypeError: ...__init__() got an unexpected keyword argument 'Sparse'
TypeError: ...__init__() got an unexpected keyword argument 'Sparse'...
2 changes: 1 addition & 1 deletion src/doc/pt/tutorial/tour_linalg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,4 @@ Note que o Python é sensível a maiúsculas e minúsculas:
sage: M = MatrixSpace(QQ, 10,10, Sparse=True)
Traceback (most recent call last):
...
TypeError: ...__init__() got an unexpected keyword argument 'Sparse'
TypeError: ...__init__() got an unexpected keyword argument 'Sparse'...
2 changes: 1 addition & 1 deletion src/doc/ru/tutorial/tour_linalg.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,4 +210,4 @@ Sage поддерживает разреженную линейную алгеб
sage: M = MatrixSpace(QQ, 10,10, Sparse=True)
Traceback (most recent call last):
...
TypeError: ...__init__() got an unexpected keyword argument 'Sparse'
TypeError: ...__init__() got an unexpected keyword argument 'Sparse'...
4 changes: 2 additions & 2 deletions src/sage/categories/map.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ cdef class Map(Element):
maps::
sage: phi.domain # needs sage.rings.number_field
<weakref at ...; to 'NumberField_quadratic_with_category' at ...>
<weakref at ...; to '...NumberField_quadratic_with_category' at ...>
sage: phi._make_strong_references() # needs sage.rings.number_field
sage: print(phi.domain) # needs sage.rings.number_field
The constant function (...) -> Number Field in a
Expand Down Expand Up @@ -343,7 +343,7 @@ cdef class Map(Element):
maps::
sage: phi.domain # needs sage.rings.number_field
<weakref at ...; to 'NumberField_quadratic_with_category' at ...>
<weakref at ...; to '...NumberField_quadratic_with_category' at ...>
sage: phi._make_strong_references() # needs sage.rings.number_field
sage: print(phi.domain) # needs sage.rings.number_field
The constant function (...) -> Number Field in a
Expand Down
2 changes: 1 addition & 1 deletion src/sage/misc/bindable_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class BindableClass(metaclass=ClasscallMetaclass):
Still, documentation works as usual::
sage: outer.Inner.__doc__
' some documentation '
'...some documentation '
TESTS::
Expand Down
14 changes: 7 additions & 7 deletions src/sage/misc/sagedoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ def format(s, embedded=False):
We check that the todo Sphinx extension is correctly activated::
sage: sage.misc.sagedoc.format(sage.combinat.ranker.on_fly.__doc__) # needs sphinx
" Return ... Todo: add tests as in combinat::rankers\n"
"...Return ...Todo: add tests as in combinat::rankers\n"
In the following use case, the ``nodetex`` directive would have been ignored prior
to :issue:`11815`::
Expand Down Expand Up @@ -1135,10 +1135,11 @@ def search_src(string, extra1='', extra2='', extra3='', extra4='',
The following produces an error because the string 'fetch(' is a
malformed regular expression::
sage: print(search_src(" fetch(", "def", interact=False))
Traceback (most recent call last):
...
error: missing ), unterminated subpattern at position 6
sage: try:
....: print(search_src(" fetch(", "def", interact=False))
....: except Exception as e:
....: print(e)
missing ), unterminated subpattern at position 6
To fix this, *escape* the parenthesis with a backslash::
Expand Down Expand Up @@ -1186,7 +1187,6 @@ def search_src(string, extra1='', extra2='', extra3='', extra4='',
misc/sagedoc.py:... len(search_src("matrix", interact=False).splitlines())...
misc/sagedoc.py:... len(search_src("matrix", module="sage.calculus", interact=False).splitlines())...
misc/sagedoc.py:... len(search_src("matrix", path_re="calc"...
misc/sagedoc.py:... print(search_src(" fetch(", "def", interact=False))...
misc/sagedoc.py:... print(search_src(r" fetch\(", "def", interact=False))...
misc/sagedoc.py:... print(search_src(r" fetch\(", "def", "pyx", interact=False))...
misc/sagedoc.py:... s = search_src('Matrix', path_re='matrix', interact=False); s.find('x') > 0...
Expand Down Expand Up @@ -1456,7 +1456,7 @@ class _sage_doc:
sage: browse_sage_doc._open("reference", testing=True)[0] # needs sagemath_doc_html
'http://localhost:8000/doc/live/reference/index.html'
sage: browse_sage_doc(identity_matrix, 'rst')[-107:-47] # needs sage.modules
'Full MatrixSpace of 3 by 3 sparse matrices over Integer Ring'
'...Full MatrixSpace of 3 by 3 sparse matrices...'
"""
def __init__(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion src/sage/misc/sageinspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -1986,7 +1986,7 @@ def sage_getdoc(obj, obj_name='', embedded=False):
sage: from sage.misc.sageinspect import sage_getdoc
sage: sage_getdoc(identity_matrix)[87:124] # needs sage.modules
'Return the n x n identity matrix over'
'...the n x n identity matrix...'
sage: def f(a, b, c, d=1): return a+b+c+d
...
sage: import functools
Expand Down
2 changes: 1 addition & 1 deletion src/sage/modular/modsym/modsym.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def ModularSymbols(group=1,
{}
sage: M = ModularSymbols(11,use_cache=True)
sage: sage.modular.modsym.modsym._cache
{(Congruence Subgroup Gamma0(11), 2, 0, Rational Field): <weakref at ...; to 'ModularSymbolsAmbient_wt2_g0_with_category' at ...>}
{(Congruence Subgroup Gamma0(11), 2, 0, Rational Field): <weakref at ...; to '...ModularSymbolsAmbient_wt2_g0_with_category' at ...>}
sage: M is ModularSymbols(11,use_cache=True)
True
sage: M is ModularSymbols(11,use_cache=False)
Expand Down
4 changes: 2 additions & 2 deletions src/sage/repl/attach.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
....: traceback.print_exc(file=sys.stdout)
Traceback (most recent call last):
...
exec(preparse_file(f.read()) + "\n", globals)
exec(preparse_file(f.read()) + "\n", globals)...
File "<string>", line 3, in <module>
ValueError: third
sage: detach(src)
Expand All @@ -52,7 +52,7 @@
....: traceback.print_exc(file=sys.stdout)
Traceback (most recent call last):
...
exec(code, globals)
exec(code, globals)...
File ".../foobar...sage.py", line ..., in <module>
raise ValueError("third") # this should appear in the source snippet...
ValueError: third
Expand Down
2 changes: 1 addition & 1 deletion src/sage/repl/rich_output/pretty_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def pretty_print(self):
sage: seq._concatenate_graphs().show(edge_labels=True) # needs sage.graphs sage.plot
Traceback (most recent call last):
...
TypeError: ...matplotlib() got an unexpected keyword argument 'edge_labels'
TypeError: ...matplotlib() got an unexpected keyword argument 'edge_labels'...
"""
try:
from sage.plot.plot import Graphics
Expand Down

0 comments on commit dbdc77f

Please sign in to comment.