Skip to content

Commit 7195b8f

Browse files
committed
update doctests for cython 3
1 parent a632238 commit 7195b8f

12 files changed

+19
-19
lines changed

src/doc/en/thematic_tutorials/coercion_and_categories.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ it makes sense to build on top of the base class
105105
This base class provides a lot more methods than a general parent::
106106

107107
sage: [p for p in dir(Field) if p not in dir(Parent)]
108-
['__fraction_field',
108+
['_CommutativeRing__fraction_field',
109109
'__iter__',
110110
'__len__',
111111
'__rxor__',

src/sage/arith/srange.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def xsrange(start, end=None, step=1, universe=None, *, coerce=True, bint include
8484
EXAMPLES::
8585
8686
sage: xsrange(10)
87-
<generator object at 0x...>
87+
<_cython_3_0_0.generator object at 0x...>
8888
sage: for i in xsrange(1,5):
8989
....: print(i)
9090
1

src/sage/combinat/sloane_functions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9171,7 +9171,7 @@ def __getattribute__(self, name):
91719171
::
91729172
91739173
sage: sloane.__repr__
9174-
<method-wrapper '__repr__' of Sloane object at 0x...>
9174+
<built-in method __repr__ of Sloane object at 0x...>
91759175
sage: sloane.__name__
91769176
Traceback (most recent call last):
91779177
...

src/sage/misc/cachefunc.pyx

+4-3
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ be used::
4949
sage: cython('''cpdef test_funct(x): return -x''') # optional - sage.misc.cython
5050
sage: wrapped_funct = cached_function(test_funct, name='wrapped_funct') # optional - sage.misc.cython
5151
sage: wrapped_funct # optional - sage.misc.cython
52-
Cached version of <built-in function test_funct>
52+
Cached version of <cyfunction test_funct at ...>
5353
sage: wrapped_funct.__name__ # optional - sage.misc.cython
5454
'wrapped_funct'
5555
sage: wrapped_funct(5) # optional - sage.misc.cython
@@ -80,9 +80,9 @@ approach is still needed for cpdef methods::
8080
sage: cython(os.linesep.join(cython_code)) # optional - sage.misc.cython
8181
sage: O = MyClass() # optional - sage.misc.cython
8282
sage: O.direct_method # optional - sage.misc.cython
83-
Cached version of <method 'direct_method' of '...MyClass' objects>
83+
Cached version of <cyfunction MyClass.direct_method at ...>
8484
sage: O.wrapped_method # optional - sage.misc.cython
85-
Cached version of <built-in function test_meth>
85+
Cached version of <cyfunction test_meth at ...>
8686
sage: O.wrapped_method.__name__ # optional - sage.misc.cython
8787
'wrapped_method'
8888
sage: O.wrapped_method(5) # optional - sage.misc.cython
@@ -263,6 +263,7 @@ Introspection works::
263263
"some doc for a wrapped cython method"
264264
return -x
265265
sage: print(sage_getsource(O.direct_method)) # optional - sage.misc.cython
266+
@cached_method
266267
def direct_method(self, x):
267268
"Some doc for direct method"
268269
return 2*x

src/sage/misc/lazy_import.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1091,7 +1091,7 @@ def lazy_import(module, names, as_=None, *,
10911091
sage: from sage.features import PythonModule
10921092
sage: lazy_import('ppl', 'equation', feature=PythonModule('ppl', spkg='pplpy', type='standard'))
10931093
sage: equation
1094-
<built-in function equation>
1094+
<cyfunction equation at ...>
10951095
sage: lazy_import('PyNormaliz', 'NmzListConeProperties', feature=PythonModule('PyNormaliz', spkg='pynormaliz')) # optional - pynormaliz
10961096
sage: NmzListConeProperties # optional - pynormaliz
10971097
<built-in function NmzListConeProperties>

src/sage/misc/lazy_list.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,7 @@ cdef class lazy_list_generic():
677677
sage: from itertools import count
678678
sage: from sage.misc.lazy_list import lazy_list
679679
sage: iter(lazy_list(count()))
680-
<generator object at 0x...>
680+
<_cython_3_0_0.generator object at 0x...>
681681
682682
::
683683

src/sage/misc/sageinspect.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@
7676
sage: sage_getdoc(sage.rings.rational.make_rational).lstrip()
7777
'Make a rational number ...'
7878
79-
sage: sage_getsource(sage.rings.rational.make_rational)[4:]
80-
'make_rational(s):...'
79+
sage: sage_getsource(sage.rings.rational.make_rational)
80+
'@cython.binding(True)\ndef make_rational(s):...'
8181
8282
Python functions::
8383

src/sage/modules/free_module_element.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,7 @@ cdef class FreeModuleElement(Vector): # abstract base class
16121612
16131613
sage: v = vector([1,2/3,pi])
16141614
sage: v.items()
1615-
<generator object at ...>
1615+
<_cython_3_0_0.generator object at ...>
16161616
sage: list(v.items())
16171617
[(0, 1), (1, 2/3), (2, pi)]
16181618

src/sage/rings/finite_rings/finite_field_base.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ cdef class FiniteField(Field):
328328
sage: p = next_prime(2^64)
329329
sage: k.<a> = FiniteField(p^2, impl="pari")
330330
sage: it = iter(k); it
331-
<generator object at ...>
331+
<_cython_3_0_0.generator object at ...>
332332
sage: [next(it) for i in range(10)]
333333
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
334334

src/sage/rings/polynomial/skew_polynomial_finite_field.pyx

+3-3
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ cdef class SkewPolynomial_finite_field_dense(SkewPolynomial_finite_order_dense):
629629
sage: S.<x> = k['x',Frob]
630630
sage: a = x^4 + 2*t*x^3 + 3*t^2*x^2 + (t^2 + t + 1)*x + 4*t + 3
631631
sage: iter = a.right_irreducible_divisors(); iter
632-
<generator object at 0x...>
632+
<_cython_3_0_0.generator object at 0x...>
633633
sage: next(iter) # random
634634
x + 2*t^2 + 4*t + 4
635635
sage: next(iter) # random
@@ -664,7 +664,7 @@ cdef class SkewPolynomial_finite_field_dense(SkewPolynomial_finite_order_dense):
664664
sage: S.<x> = k['x',Frob]
665665
sage: a = x^4 + 2*t*x^3 + 3*t^2*x^2 + (t^2 + t + 1)*x + 4*t + 3
666666
sage: iter = a.left_irreducible_divisors(); iter
667-
<generator object at 0x...>
667+
<_cython_3_0_0.generator object at 0x...>
668668
sage: next(iter) # random
669669
x + 3*t + 3
670670
sage: next(iter) # random
@@ -1052,7 +1052,7 @@ cdef class SkewPolynomial_finite_field_dense(SkewPolynomial_finite_order_dense):
10521052
sage: S.<x> = k['x',Frob]
10531053
sage: a = x^3 + (t^2 + 1)*x^2 + (2*t + 3)*x + t^2 + t + 2
10541054
sage: iter = a.factorizations(); iter
1055-
<generator object at 0x...>
1055+
<_cython_3_0_0.generator object at 0x...>
10561056
sage: next(iter) # random
10571057
(x + 3*t^2 + 4*t) * (x + 2*t^2) * (x + 4*t^2 + 4*t + 2)
10581058
sage: next(iter) # random

src/sage/structure/coerce_dict.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ cdef class MonoDict:
776776
sage: L[1] = None
777777
sage: L[2] = True
778778
sage: L.items()
779-
<generator object at ...>
779+
<_cython_3_0_0.generator object at ...>
780780
sage: sorted(L.items())
781781
[(1, None), (2, True)]
782782
"""
@@ -1451,7 +1451,7 @@ cdef class TripleDict:
14511451
sage: L = TripleDict()
14521452
sage: L[1,2,3] = None
14531453
sage: L.items()
1454-
<generator object at ...>
1454+
<_cython_3_0_0.generator object at ...>
14551455
sage: list(L.items())
14561456
[((1, 2, 3), None)]
14571457
"""

src/sage/tests/cmdline.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -491,9 +491,8 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False
491491
492492
sage: (out, err, ret) = test_executable(["sage", "--cython"])
493493
sage: print(err)
494-
Cython (http://cython.org) is a compiler for code written in the
495-
Cython language. Cython is based on Pyrex by Greg Ewing.
496494
...
495+
cython: error: cython: Need at least one source file
497496
498497
sage: def has_tty():
499498
....: try:

0 commit comments

Comments
 (0)