Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sage.tests: Update # needs #36657

Merged
merged 15 commits into from
Dec 6, 2023
4 changes: 2 additions & 2 deletions src/sage/doctest/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,9 @@ def reproducible_repr(val):
frozenset(['a', 'b', 'c', 'd'])
sage: print(reproducible_repr([1, frozenset("cab"), set("bar"), 0]))
[1, frozenset(['a', 'b', 'c']), set(['a', 'b', 'r']), 0]
sage: print(reproducible_repr({3.0:"three","2":"two",1:"one"}))
sage: print(reproducible_repr({3.0: "three", "2": "two", 1: "one"})) # optional - sage.rings.real_mpfr
{'2': 'two', 1: 'one', 3.00000000000000: 'three'}
sage: print(reproducible_repr("foo\nbar")) # demonstrate default case
sage: print(reproducible_repr("foo\nbar")) # demonstrate default case
'foo\nbar'
"""

Expand Down
2 changes: 1 addition & 1 deletion src/sage/ext/fast_callable.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1645,7 +1645,7 @@ class IntegerPowerFunction():
pi^2
sage: square(I) # needs sage.symbolic
-1
sage: square(RIF(-1, 1)).str(style='brackets')
sage: square(RIF(-1, 1)).str(style='brackets') # needs sage.rings.real_interval_field
'[0.0000000000000000 .. 1.0000000000000000]'
sage: IntegerPowerFunction(-1)
(^(-1))
Expand Down
1 change: 1 addition & 0 deletions src/sage/libs/coxeter3/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# sage_setup: distribution = sagemath-coxeter3
1 change: 1 addition & 0 deletions src/sage/libs/coxeter3/all__sagemath_coxeter3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# sage_setup: distribution = sagemath-coxeter3
2 changes: 2 additions & 0 deletions src/sage/structure/coerce.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,8 @@ cdef class CoercionModel:
Check that :trac:`8426` is fixed (see also :trac:`18076`)::

sage: import numpy # needs numpy

sage: # needs sage.rings.real_mpfr
sage: x = polygen(RR)
sage: numpy.float32('1.5') * x # needs numpy
1.50000000000000*x
Expand Down
7 changes: 4 additions & 3 deletions src/sage/structure/factorization.py
Original file line number Diff line number Diff line change
Expand Up @@ -1232,9 +1232,10 @@ def __call__(self, *args, **kwds):
sage: F(t=0)
0

sage: R.<x> = LaurentPolynomialRing(QQ, 1) # needs sage.modules
sage: F = ((x+2)/x**3).factor() # needs sage.modules
sage: F(x=4) # needs sage.modules
sage: # needs sage.libs.pari sage.modules
sage: R.<x> = LaurentPolynomialRing(QQ, 1)
sage: F = ((x+2)/x**3).factor()
sage: F(x=4)
1/64 * 6
"""
unit = self.__unit.subs(*args, **kwds)
Expand Down
2 changes: 1 addition & 1 deletion src/sage/structure/parent_old.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ cdef class Parent(parent.Parent):
[(0, 0), (1, 0), (0, 1), (1, 1)]
sage: MatrixSpace(GF(3), 1, 1).list()
[[0], [1], [2]]
sage: DirichletGroup(3).list() # needs sage.modular
sage: DirichletGroup(3).list() # needs sage.libs.pari sage.modular
[Dirichlet character modulo 3 of conductor 1 mapping 2 |--> 1,
Dirichlet character modulo 3 of conductor 3 mapping 2 |--> -1]

Expand Down
7 changes: 4 additions & 3 deletions src/sage/symbolic/function.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,11 @@ cdef class Function(SageObject):
sage: hurwitz_zeta(1/2, b)
hurwitz_zeta(1/2, [1.500000000 +/- 1.01e-10])

sage: iv = RIF(1, 1.0001)
sage: airy_ai(iv)
sage: iv = RIF(1, 1.0001) # needs sage.rings.real_interval_field

sage: airy_ai(iv) # needs sage.rings.real_interval_field
airy_ai(1.0001?)
sage: airy_ai(CIF(iv))
sage: airy_ai(CIF(iv)) # needs sage.rings.complex_interval_field
airy_ai(1.0001?)
"""
if isinstance(x, (float, complex)):
Expand Down
45 changes: 23 additions & 22 deletions src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# sage.doctest: needs sage.graphs sage.modules
r"""
This file contains doctests of the article ::

Expand Down Expand Up @@ -505,11 +506,11 @@

Sage example in fsm-in-sage.tex, line 1091::

sage: var('y')
sage: var('y') # needs sage.symbolic
y
sage: def am_entry(trans):
....: return y^add(trans.word_out) / 2
sage: A = W.adjacency_matrix(entry=am_entry)
sage: A = W.adjacency_matrix(entry=am_entry) # needs sage.symbolic


Sage example in fsm-in-sage.tex, line 1097::
Expand All @@ -519,7 +520,7 @@

Sage example in fsm-in-sage.tex, line 1099::

sage: latex(A)
sage: latex(A) # needs sage.symbolic
\left(\begin{array}{ccccccccc}
\frac{1}{2} & \frac{1}{2} \, y^{2} & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\
0 & 0 & \frac{1}{2} & \frac{1}{2} & 0 & 0 & 0 & 0 & 0 \\
Expand All @@ -535,95 +536,95 @@

Sage example in fsm-in-sage.tex, line 1109::

sage: (pi_not_normalized,) = (A.subs(y=1) - A.parent().identity_matrix())\
....: .left_kernel().basis()
sage: pi = pi_not_normalized / pi_not_normalized.norm(p=1)
sage: A1mI = (A.subs(y=1) - A.parent().identity_matrix()) # needs sage.symbolic
sage: (pi_not_normalized,) = A1mI.left_kernel().basis() # needs sage.symbolic
sage: pi = pi_not_normalized / pi_not_normalized.norm(p=1) # needs sage.symbolic


Sage example in fsm-in-sage.tex, line 1110::

sage: str(pi)
sage: str(pi) # needs sage.symbolic
'(1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9, 1/9)'


Sage example in fsm-in-sage.tex, line 1117::

sage: expected_output = derivative(A, y).subs(y=1) * vector(len(W.states())*[1])
sage: expected_output = derivative(A, y).subs(y=1) * vector(len(W.states())*[1]) # needs sage.symbolic


Sage example in fsm-in-sage.tex, line 1118::

sage: latex(expected_output)
sage: latex(expected_output) # needs sage.symbolic
\left(1,\,0,\,0,\,0,\,\frac{1}{2},\,1,\,1,\,\frac{1}{2},\,1\right)


Sage example in fsm-in-sage.tex, line 1126::

sage: pi * expected_output
sage: pi * expected_output # needs sage.symbolic
5/9


Sage example in fsm-in-sage.tex, line 1127::

sage: latex(pi * expected_output)
sage: latex(pi * expected_output) # needs sage.symbolic
\frac{5}{9}


Sage example in fsm-in-sage.tex, line 1129::

sage: latex(pi * expected_output)
sage: latex(pi * expected_output) # needs sage.symbolic
\frac{5}{9}


Sage example in fsm-in-sage.tex, line 1145::

sage: var('k')
sage: var('k') # needs sage.symbolic
k
sage: moments = W.asymptotic_moments(k)
sage: moments = W.asymptotic_moments(k) # needs sage.symbolic


Sage example in fsm-in-sage.tex, line 1155::

sage: latex(moments['expectation'])
sage: latex(moments['expectation']) # needs sage.symbolic
\frac{5}{9} \, k + \mathcal{O}\left(1\right)


Sage example in fsm-in-sage.tex, line 1162::

sage: latex(moments['variance'])
sage: latex(moments['variance']) # needs sage.symbolic
\frac{44}{243} \, k + \mathcal{O}\left(1\right)


Sage example in fsm-in-sage.tex, line 1192::

sage: expectation_binary = Id.asymptotic_moments(k)['expectation']
sage: expectation_binary = Id.asymptotic_moments(k)['expectation'] # needs sage.symbolic


Sage example in fsm-in-sage.tex, line 1195::

sage: latex(expectation_binary)
sage: latex(expectation_binary) # needs sage.symbolic
\frac{1}{2} \, k + \mathcal{O}\left(1\right)


Sage example in fsm-in-sage.tex, line 1202::

sage: expectation_NAF = Weight(NAF).asymptotic_moments(k)['expectation']
sage: expectation_NAF = Weight(NAF).asymptotic_moments(k)['expectation'] # needs sage.symbolic


Sage example in fsm-in-sage.tex, line 1205::

sage: latex(expectation_NAF)
sage: latex(expectation_NAF) # needs sage.symbolic
\frac{1}{3} \, k + \mathcal{O}\left(1\right)


Sage example in fsm-in-sage.tex, line 1211::

sage: Abs = transducers.abs([-1, 0, 1])
sage: Abs = transducers.abs([-1, 0, 1]) # needs sage.symbolic


Sage example in fsm-in-sage.tex, line 1216::

sage: latex(moments['expectation'])
sage: latex(moments['expectation']) # needs sage.symbolic
\frac{5}{9} \, k + \mathcal{O}\left(1\right)

"""
1 change: 1 addition & 0 deletions src/sage/tests/arxiv_0812_2725.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# sage.doctest: needs sage.combinat
r"""
Sage code for computing k-distant crossing numbers.

Expand Down
1 change: 1 addition & 0 deletions src/sage/tests/benchmark.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# sage.doctest: needs sage.symbolic
"""
Benchmarks

Expand Down
14 changes: 8 additions & 6 deletions src/sage/tests/book_schilling_zabrocki_kschur_primer.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# sage.doctest: needs sage.combinat sage.graphs sage.groups
r"""
This file contains doctests for the Chapter "k-Schur function primer"
for the book "k-Schur functions and affine Schubert calculus"
Expand Down Expand Up @@ -83,16 +84,17 @@

Sage example in ./kschurnotes/notes-mike-anne.tex, line 406::

sage: w = W.an_element(); w # long time
sage: # long time
sage: w = W.an_element(); w
[ 2 0 0 1 -2]
[ 2 0 0 0 -1]
[ 1 1 0 0 -1]
[ 1 0 1 0 -1]
[ 1 0 0 1 -1]
sage: w.reduced_word() # long time
sage: w.reduced_word()
[0, 1, 2, 3, 4]
sage: w = W.from_reduced_word([2,1,0]) # long time
sage: w.is_affine_grassmannian() # long time
sage: w = W.from_reduced_word([2,1,0])
sage: w.is_affine_grassmannian()
True

Sage example in ./kschurnotes/notes-mike-anne.tex, line 464::
Expand Down Expand Up @@ -576,8 +578,8 @@

Sage example in ./kschurnotes/notes-mike-anne.tex, line 4055::

sage: t = var('t')
sage: for mu in Partitions(5):
sage: t = var('t') # needs sage.symbolic
sage: for mu in Partitions(5): # needs sage.symbolic
....: print("{} {}".format(mu, sum(t^T.spin() for T in StrongTableaux(3,[4,1,1],mu))))
[5] 0
[4, 1] t
Expand Down
35 changes: 22 additions & 13 deletions src/sage/tests/book_stein_ent.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# sage.doctest: needs sage.libs.pari
"""
This file contains all the example code from the published book
'Elementary Number Theory: Primes, Congruences, and Secrets' by
Expand Down Expand Up @@ -32,7 +33,7 @@
sage: n.is_prime() # this is instant
False
sage: p = 2^32582657 - 1
sage: p.ndigits()
sage: p.ndigits() # needs sage.rings.real_interval_field
9808358
sage: s = p.str(10) # this takes a long time
sage: len(s) # s is a very long string (long time)
Expand All @@ -41,18 +42,23 @@
'12457502601536945540'
sage: s[-20:] # the last 20 digits (long time)
'11752880154053967871'

sage: # needs sage.symbolic
sage: prime_pi(6)
3
sage: prime_pi(100)
25
sage: prime_pi(3000000)
216816

sage: # needs sage.plot sage.symbolic
sage: plot(prime_pi, 1,1000, rgbcolor=(0,0,1))
Graphics object consisting of 1 graphics primitive
sage: P = plot(Li, 2,10000, rgbcolor='purple')
sage: Q = plot(prime_pi, 2,10000, rgbcolor='black')
sage: R = plot(sqrt(x)*log(x),2,10000,rgbcolor='red')
sage: show(P+Q+R,xmin=0, figsize=[8,3])
sage: R = plot(sqrt(x)*log(x), 2,10000, rgbcolor='red')
sage: show(P + Q + R, xmin=0, figsize=[8,3])

sage: R = Integers(3)
sage: list(R)
[0, 1, 2]
Expand Down Expand Up @@ -157,15 +163,15 @@
1.09861228866811
sage: log(19683.0) / log(3.0)
9.00000000000000
sage: plot(log, 0.1,10, rgbcolor=(0,0,1))
sage: plot(log, 0.1, 10, rgbcolor=(0,0,1)) # needs sage.plot
Graphics object consisting of 1 graphics primitive
sage: p = 53
sage: R = Integers(p)
sage: a = R.multiplicative_generator()
sage: v = sorted([(a^n, n) for n in range(p-1)])
sage: G = plot(point(v,pointsize=50,rgbcolor=(0,0,1)))
sage: H = plot(line(v,rgbcolor=(0.5,0.5,0.5)))
sage: G + H
sage: G = plot(point(v,pointsize=50,rgbcolor=(0,0,1))) # needs sage.plot
sage: H = plot(line(v,rgbcolor=(0.5,0.5,0.5))) # needs sage.plot
sage: G + H # needs sage.plot
Graphics object consisting of 2 graphics primitives
sage: q = 93450983094850938450983409623
sage: q.is_prime()
Expand Down Expand Up @@ -421,11 +427,14 @@
[1, 2, 7, 30, 157]
sage: c = continued_fraction([1,1,1,1,1,1,1,1])
sage: v = [(i, c.p(i)/c.q(i)) for i in range(len(c))]

sage: # needs sage.plot
sage: P = point(v, rgbcolor=(0,0,1), pointsize=40)
sage: L = line(v, rgbcolor=(0.5,0.5,0.5))
sage: L2 = line([(0,c.value()),(len(c)-1,c.value())], \
....: thickness=0.5, rgbcolor=(0.7,0,0))
sage: (L+L2+P).show(xmin=0,ymin=1)
sage: L2 = line([(0,c.value()), (len(c)-1,c.value())],
....: thickness=0.5, rgbcolor=(0.7,0,0))
sage: (L + L2 + P).show(xmin=0, ymin=1)

sage: def cf(bits):
....: x = (1 + sqrt(RealField(bits)(5))) / 2
....: return continued_fraction(x)
Expand Down Expand Up @@ -497,13 +506,13 @@
sage: E
Elliptic Curve defined by y^2 = x^3 - 5*x + 4
over Rational Field
sage: P = E.plot(thickness=4,rgbcolor=(0.1,0.7,0.1))
sage: P.show(figsize=[4,6])
sage: P = E.plot(thickness=4,rgbcolor=(0.1,0.7,0.1)) # needs sage.plot
sage: P.show(figsize=[4,6]) # needs sage.plot
sage: E = EllipticCurve(GF(37), [1,0])
sage: E
Elliptic Curve defined by y^2 = x^3 + x over
Finite Field of size 37
sage: E.plot(pointsize=45)
sage: E.plot(pointsize=45) # needs sage.plot
Graphics object consisting of 1 graphics primitive
sage: E = EllipticCurve([-5,4])
sage: P = E([1,0]); Q = E([0,2])
Expand Down
4 changes: 4 additions & 0 deletions src/sage/tests/book_stein_modform.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# sage_setup: distribution = sagemath-repl
# sage.doctest: needs sage.libs.flint sage.modular
"""
This file contains a bunch of tests extracted from the published book
'Modular Forms: a Computational Approach' by William Stein, AMS 2007.

TESTS::

sage: # needs sage.libs.gap
sage: G = SL(2,ZZ); G
Special Linear Group of degree 2 over Integer Ring
sage: S, T = G.gens()
Expand All @@ -13,6 +16,7 @@
sage: T
[1 1]
[0 1]

sage: delta_qexp(6)
q - 24*q^2 + 252*q^3 - 1472*q^4 + 4830*q^5 + O(q^6)
sage: bernoulli(12)
Expand Down
Loading
Loading