From ed209d1512e17332480d5e2108049d95a9057882 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Wed, 17 May 2023 13:20:30 -0700 Subject: [PATCH 01/15] Massive modularization fixes --- ...ticle_heuberger_krenn_kropf_fsm-in-sage.py | 46 +++++++++---------- src/sage/tests/benchmark.py | 1 + src/sage/tests/book_stein_ent.py | 16 +++---- src/sage/tests/gosper-sum.py | 1 + src/sage/tests/symbolic-series.py | 1 + src/sage/tests/sympy.py | 1 + 6 files changed, 35 insertions(+), 31 deletions(-) diff --git a/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py b/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py index 6125930bd45..2df7199c47b 100644 --- a/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py +++ b/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py @@ -505,21 +505,21 @@ Sage example in fsm-in-sage.tex, line 1091:: - sage: var('y') + sage: var('y') # optional - sage.symbolic y - sage: def am_entry(trans): + sage: def am_entry(trans): # optional - sage.symbolic ....: return y^add(trans.word_out) / 2 - sage: A = W.adjacency_matrix(entry=am_entry) + sage: A = W.adjacency_matrix(entry=am_entry) # optional - sage.symbolic Sage example in fsm-in-sage.tex, line 1097:: - sage: latex.matrix_column_alignment('c') + sage: latex.matrix_column_alignment('c') # optional - sage.symbolic Sage example in fsm-in-sage.tex, line 1099:: - sage: latex(A) + sage: latex(A) # optional - 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 \\ @@ -535,95 +535,95 @@ Sage example in fsm-in-sage.tex, line 1109:: - sage: (pi_not_normalized,) = (A.subs(y=1) - A.parent().identity_matrix())\ + sage: (pi_not_normalized,) = (A.subs(y=1) - A.parent().identity_matrix())\ # optional - sage.symbolic ....: .left_kernel().basis() - sage: pi = pi_not_normalized / pi_not_normalized.norm(p=1) + sage: pi = pi_not_normalized / pi_not_normalized.norm(p=1) # optional - sage.symbolic Sage example in fsm-in-sage.tex, line 1110:: - sage: str(pi) + sage: str(pi) # optional - 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]) # optional - sage.symbolic Sage example in fsm-in-sage.tex, line 1118:: - sage: latex(expected_output) + sage: latex(expected_output) # optional - 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 # optional - sage.symbolic 5/9 Sage example in fsm-in-sage.tex, line 1127:: - sage: latex(pi * expected_output) + sage: latex(pi * expected_output) # optional - sage.symbolic \frac{5}{9} Sage example in fsm-in-sage.tex, line 1129:: - sage: latex(pi * expected_output) + sage: latex(pi * expected_output) # optional - sage.symbolic \frac{5}{9} Sage example in fsm-in-sage.tex, line 1145:: - sage: var('k') + sage: var('k') # optional - sage.symbolic k - sage: moments = W.asymptotic_moments(k) + sage: moments = W.asymptotic_moments(k) # optional - sage.symbolic Sage example in fsm-in-sage.tex, line 1155:: - sage: latex(moments['expectation']) + sage: latex(moments['expectation']) # optional - 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']) # optional - 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'] # optional - sage.symbolic Sage example in fsm-in-sage.tex, line 1195:: - sage: latex(expectation_binary) + sage: latex(expectation_binary) # optional - 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'] # optional - sage.symbolic Sage example in fsm-in-sage.tex, line 1205:: - sage: latex(expectation_NAF) + sage: latex(expectation_NAF) # optional - 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]) # optional - sage.symbolic Sage example in fsm-in-sage.tex, line 1216:: - sage: latex(moments['expectation']) + sage: latex(moments['expectation']) # optional - sage.symbolic \frac{5}{9} \, k + \mathcal{O}\left(1\right) """ diff --git a/src/sage/tests/benchmark.py b/src/sage/tests/benchmark.py index 626388bd3ab..9f8d665e646 100644 --- a/src/sage/tests/benchmark.py +++ b/src/sage/tests/benchmark.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.symbolic """ Benchmarks diff --git a/src/sage/tests/book_stein_ent.py b/src/sage/tests/book_stein_ent.py index af4f77eb566..b03b5ad3a02 100644 --- a/src/sage/tests/book_stein_ent.py +++ b/src/sage/tests/book_stein_ent.py @@ -41,18 +41,18 @@ '12457502601536945540' sage: s[-20:] # the last 20 digits (long time) '11752880154053967871' -sage: prime_pi(6) +sage: prime_pi(6) # optional - sage.symbolic 3 -sage: prime_pi(100) +sage: prime_pi(100) # optional - sage.symbolic 25 -sage: prime_pi(3000000) +sage: prime_pi(3000000) # optional - sage.symbolic 216816 -sage: plot(prime_pi, 1,1000, rgbcolor=(0,0,1)) +sage: plot(prime_pi, 1,1000, rgbcolor=(0,0,1)) # optional - sage.plot sage.symbolic 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: P = plot(Li, 2,10000, rgbcolor='purple') # optional - sage.plot sage.symbolic +sage: Q = plot(prime_pi, 2,10000, rgbcolor='black') # optional - sage.plot sage.symbolic +sage: R = plot(sqrt(x)*log(x),2,10000,rgbcolor='red') # optional - sage.plot sage.symbolic +sage: show(P+Q+R,xmin=0, figsize=[8,3]) # optional - sage.plot sage.symbolic sage: R = Integers(3) sage: list(R) [0, 1, 2] diff --git a/src/sage/tests/gosper-sum.py b/src/sage/tests/gosper-sum.py index 76c2438d1c9..16d195dc71b 100644 --- a/src/sage/tests/gosper-sum.py +++ b/src/sage/tests/gosper-sum.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.symbolic """ Some tests about Gosper sums. diff --git a/src/sage/tests/symbolic-series.py b/src/sage/tests/symbolic-series.py index fb42289074d..4aff094d364 100644 --- a/src/sage/tests/symbolic-series.py +++ b/src/sage/tests/symbolic-series.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sage.symbolic """ Tests for the fast univariate series expansion in Pynac ------------------------------------------------------- diff --git a/src/sage/tests/sympy.py b/src/sage/tests/sympy.py index a42dcab7b2a..2f98f95e00c 100644 --- a/src/sage/tests/sympy.py +++ b/src/sage/tests/sympy.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - sympy r""" TESTS: From ec4ac24baeededd93b395bc5420760adb967abca Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 20 May 2023 15:38:10 -0700 Subject: [PATCH 02/15] More # optional --- .../book_schilling_zabrocki_kschur_primer.py | 4 ++-- src/sage/tests/book_stein_ent.py | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/sage/tests/book_schilling_zabrocki_kschur_primer.py b/src/sage/tests/book_schilling_zabrocki_kschur_primer.py index b0d56792851..55e6781d0f1 100644 --- a/src/sage/tests/book_schilling_zabrocki_kschur_primer.py +++ b/src/sage/tests/book_schilling_zabrocki_kschur_primer.py @@ -576,8 +576,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') # optional - sage.symbolic + sage: for mu in Partitions(5): # optional - sage.symbolic ....: print("{} {}".format(mu, sum(t^T.spin() for T in StrongTableaux(3,[4,1,1],mu)))) [5] 0 [4, 1] t diff --git a/src/sage/tests/book_stein_ent.py b/src/sage/tests/book_stein_ent.py index b03b5ad3a02..ed6b046de93 100644 --- a/src/sage/tests/book_stein_ent.py +++ b/src/sage/tests/book_stein_ent.py @@ -157,15 +157,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)) # optional - 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))) # optional - sage.plot +sage: H = plot(line(v,rgbcolor=(0.5,0.5,0.5))) # optional - sage.plot +sage: G + H # optional - sage.plot Graphics object consisting of 2 graphics primitives sage: q = 93450983094850938450983409623 sage: q.is_prime() @@ -421,11 +421,11 @@ [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: 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: P = point(v, rgbcolor=(0,0,1), pointsize=40) # optional - sage.plot +sage: L = line(v, rgbcolor=(0.5,0.5,0.5)) # optional - sage.plot +sage: L2 = line([(0,c.value()), (len(c)-1,c.value())], # optional - sage.plot +....: thickness=0.5, rgbcolor=(0.7,0,0)) +sage: (L + L2 + P).show(xmin=0, ymin=1) # optional - sage.plot sage: def cf(bits): ....: x = (1 + sqrt(RealField(bits)(5))) / 2 ....: return continued_fraction(x) @@ -497,13 +497,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)) # optional - sage.plot +sage: P.show(figsize=[4,6]) # optional - 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) # optional - sage.plot Graphics object consisting of 1 graphics primitive sage: E = EllipticCurve([-5,4]) sage: P = E([1,0]); Q = E([0,2]) From e808a2c152e5b6b4ae5ba8b01cf6c5ed7d159537 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 20 May 2023 22:49:07 -0700 Subject: [PATCH 03/15] Fixups --- src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py b/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py index 2df7199c47b..1731530b9fc 100644 --- a/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py +++ b/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py @@ -535,8 +535,8 @@ Sage example in fsm-in-sage.tex, line 1109:: - sage: (pi_not_normalized,) = (A.subs(y=1) - A.parent().identity_matrix())\ # optional - sage.symbolic - ....: .left_kernel().basis() + sage: A1mI = (A.subs(y=1) - A.parent().identity_matrix()) # optional - sage.symbolic + sage: (pi_not_normalized,) = A1mI.left_kernel().basis() # optional - sage.symbolic sage: pi = pi_not_normalized / pi_not_normalized.norm(p=1) # optional - sage.symbolic From 446a1c971dd1b2f691c248714fc8dcd421b11539 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Thu, 13 Jul 2023 22:17:52 -0700 Subject: [PATCH 04/15] sage.tests: Add # needs --- ...ticle_heuberger_krenn_kropf_fsm-in-sage.py | 1 + src/sage/tests/arxiv_0812_2725.py | 1 + .../book_schilling_zabrocki_kschur_primer.py | 1 + src/sage/tests/book_stein_ent.py | 45 +++--- src/sage/tests/book_stein_modform.py | 1 + src/sage/tests/cmdline.py | 143 ++++++++++-------- src/sage/tests/combinatorial_hopf_algebras.py | 1 + src/sage/tests/finite_poset.py | 1 + src/sage/tests/gap_packages.py | 1 + src/sage/tests/lazy_imports.py | 1 + src/sage/tests/modular_group_cohomology.py | 35 ++--- src/sage/tests/numpy.py | 1 + src/sage/tests/parigp.py | 1 + 13 files changed, 133 insertions(+), 100 deletions(-) diff --git a/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py b/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py index 1731530b9fc..3828fa50d1c 100644 --- a/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py +++ b/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.graphs r""" This file contains doctests of the article :: diff --git a/src/sage/tests/arxiv_0812_2725.py b/src/sage/tests/arxiv_0812_2725.py index 3f304803c31..62217b3e8d8 100644 --- a/src/sage/tests/arxiv_0812_2725.py +++ b/src/sage/tests/arxiv_0812_2725.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat r""" Sage code for computing k-distant crossing numbers. diff --git a/src/sage/tests/book_schilling_zabrocki_kschur_primer.py b/src/sage/tests/book_schilling_zabrocki_kschur_primer.py index 55e6781d0f1..12bdc5861cf 100644 --- a/src/sage/tests/book_schilling_zabrocki_kschur_primer.py +++ b/src/sage/tests/book_schilling_zabrocki_kschur_primer.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat r""" This file contains doctests for the Chapter "k-Schur function primer" for the book "k-Schur functions and affine Schubert calculus" diff --git a/src/sage/tests/book_stein_ent.py b/src/sage/tests/book_stein_ent.py index ed6b046de93..6d8a7306878 100644 --- a/src/sage/tests/book_stein_ent.py +++ b/src/sage/tests/book_stein_ent.py @@ -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 @@ -41,18 +42,21 @@ '12457502601536945540' sage: s[-20:] # the last 20 digits (long time) '11752880154053967871' -sage: prime_pi(6) # optional - sage.symbolic + +sage: # needs sage.symbolic +sage: prime_pi(6) 3 -sage: prime_pi(100) # optional - sage.symbolic +sage: prime_pi(100) 25 -sage: prime_pi(3000000) # optional - sage.symbolic +sage: prime_pi(3000000) 216816 -sage: plot(prime_pi, 1,1000, rgbcolor=(0,0,1)) # optional - sage.plot sage.symbolic +sage: plot(prime_pi, 1,1000, rgbcolor=(0,0,1)) # needs sage.plot Graphics object consisting of 1 graphics primitive -sage: P = plot(Li, 2,10000, rgbcolor='purple') # optional - sage.plot sage.symbolic -sage: Q = plot(prime_pi, 2,10000, rgbcolor='black') # optional - sage.plot sage.symbolic -sage: R = plot(sqrt(x)*log(x),2,10000,rgbcolor='red') # optional - sage.plot sage.symbolic -sage: show(P+Q+R,xmin=0, figsize=[8,3]) # optional - sage.plot sage.symbolic +sage: P = plot(Li, 2,10000, rgbcolor='purple') # needs sage.plot +sage: Q = plot(prime_pi, 2,10000, rgbcolor='black') # needs sage.plot +sage: R = plot(sqrt(x)*log(x),2,10000,rgbcolor='red') # needs sage.plot +sage: show(P+Q+R,xmin=0, figsize=[8,3]) # needs sage.plot + sage: R = Integers(3) sage: list(R) [0, 1, 2] @@ -157,15 +161,15 @@ 1.09861228866811 sage: log(19683.0) / log(3.0) 9.00000000000000 -sage: plot(log, 0.1, 10, rgbcolor=(0,0,1)) # optional - sage.plot +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))) # optional - sage.plot -sage: H = plot(line(v,rgbcolor=(0.5,0.5,0.5))) # optional - sage.plot -sage: G + H # optional - sage.plot +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() @@ -421,11 +425,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: P = point(v, rgbcolor=(0,0,1), pointsize=40) # optional - sage.plot -sage: L = line(v, rgbcolor=(0.5,0.5,0.5)) # optional - sage.plot -sage: L2 = line([(0,c.value()), (len(c)-1,c.value())], # optional - sage.plot + +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) # optional - sage.plot +sage: (L + L2 + P).show(xmin=0, ymin=1) + sage: def cf(bits): ....: x = (1 + sqrt(RealField(bits)(5))) / 2 ....: return continued_fraction(x) @@ -497,13 +504,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)) # optional - sage.plot -sage: P.show(figsize=[4,6]) # optional - sage.plot +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) # optional - sage.plot +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]) diff --git a/src/sage/tests/book_stein_modform.py b/src/sage/tests/book_stein_modform.py index a43391ba028..56ee188cd50 100644 --- a/src/sage/tests/book_stein_modform.py +++ b/src/sage/tests/book_stein_modform.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.modular """ This file contains a bunch of tests extracted from the published book 'Modular Forms: a Computational Approach' by William Stein, AMS 2007. diff --git a/src/sage/tests/cmdline.py b/src/sage/tests/cmdline.py index 5a06a349f63..5a577d1ff83 100644 --- a/src/sage/tests/cmdline.py +++ b/src/sage/tests/cmdline.py @@ -110,62 +110,68 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False Run Sage itself with various options:: - sage: (out, err, ret) = test_executable([ # long time + sage: # long time + sage: (out, err, ret) = test_executable([ ....: "sage"], pydebug_ignore_warnings=True) - sage: out.find(version()) >= 0 # long time + sage: out.find(version()) >= 0 True - sage: err # long time + sage: err '' - sage: ret # long time + sage: ret 0 - sage: (out, err, ret) = test_executable([ # long time + sage: # long time + sage: (out, err, ret) = test_executable([ ....: "sage"], "3^33\n", pydebug_ignore_warnings=True) - sage: out.find(version()) >= 0 # long time + sage: out.find(version()) >= 0 True - sage: out.find("5559060566555523") >= 0 # long time + sage: out.find("5559060566555523") >= 0 True - sage: err # long time + sage: err '' - sage: ret # long time + sage: ret 0 - sage: (out, err, ret) = test_executable([ # long time + sage: # long time + sage: (out, err, ret) = test_executable([ ....: "sage", "-q"], "3^33\n", pydebug_ignore_warnings=True) - sage: out.find(version()) >= 0 # long time + sage: out.find(version()) >= 0 False - sage: out.find("5559060566555523") >= 0 # long time + sage: out.find("5559060566555523") >= 0 True - sage: err # long time + sage: err '' - sage: ret # long time + sage: ret 0 - sage: (out, err, ret) = test_executable([ # long time + sage: # long time + sage: (out, err, ret) = test_executable([ ....: "sage", "-c", "print(3^33)"]) - sage: print(out) # long time + sage: print(out) 5559060566555523 - sage: err # long time + sage: err '' - sage: ret # long time + sage: ret 0 - sage: (out, err, ret) = test_executable([ # long time + sage: # long time + sage: (out, err, ret) = test_executable([ ....: "sage", "--min", "-c", "print(3^33)"]) - sage: print(out) # long time + sage: print(out) 5559060566555523 - sage: err # long time + sage: err '' - sage: ret # long time + sage: ret 0 - sage: (out, err, ret) = test_executable([ # long time + sage: # long time + sage: (out, err, ret) = test_executable([ ....: "sage", "--startuptime"]) - sage: out.find("Slowest module import") >= 0 # long time + sage: out.find("Slowest module import") >= 0 True - sage: err # long time + sage: err '' - sage: ret # long time + sage: ret 0 Test help:: @@ -208,25 +214,27 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False sage: ret 0 - sage: (out, err, ret) = test_executable(["sage", "--root"]) # optional - sage_spkg - sage: len(out) >= 2 # at least one character + newline; optional - sage_spkg + sage: # optional - sage_spkg + sage: (out, err, ret) = test_executable(["sage", "--root"]) + sage: len(out) >= 2 True - sage: err # optional - sage_spkg + sage: err '' - sage: ret # optional - sage_spkg + sage: ret 0 Test ``sage --info [packages]``:: - sage: out, err, ret = test_executable(["sage", "--info", "sqlite"]) # optional - sage_spkg - sage: print(out) # optional - sage_spkg + sage: # optional - sage_spkg + sage: out, err, ret = test_executable(["sage", "--info", "sqlite"]) + sage: print(out) sqlite... SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine. ... - sage: err # optional - sage_spkg + sage: err '' - sage: ret # optional - sage_spkg + sage: ret 0 Test ``sage-run`` on a Python file, both with an absolute and with a relative path:: @@ -292,17 +300,18 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False Now test my_script.sage and the preparsed version my_script.sage.py:: - sage: (out, err, ret) = test_executable([ # long time + sage: # long time + sage: (out, err, ret) = test_executable([ ....: "sage", "-t", "--optional=sage", script]) - sage: ret # long time + sage: ret 0 - sage: out.find("All tests passed!") >= 0 # long time + sage: out.find("All tests passed!") >= 0 True - sage: (out, err, ret) = test_executable([ # long time + sage: (out, err, ret) = test_executable([ ....: "sage", "-t", "--optional=sage", script_py]) - sage: ret # long time + sage: ret 0 - sage: out.find("All tests passed!") >= 0 # long time + sage: out.find("All tests passed!") >= 0 True Test that the coding line and doctest are preserved:: @@ -438,13 +447,14 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False sage: ret 42 - sage: (out, err, ret) = test_executable([ # long time + sage: # long time + sage: (out, err, ret) = test_executable([ ....: "sage", "--ipython"], "\n3**33\n", pydebug_ignore_warnings=True) - sage: out.find("5559060566555523") >= 0 # long time + sage: out.find("5559060566555523") >= 0 True - sage: err # long time + sage: err '' - sage: ret # long time + sage: ret 0 sage: (out, err, ret) = test_executable(["sage", "--python"], "print(3^33)\n") @@ -494,13 +504,14 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False sage: ret 0 - sage: (out, err, ret) = test_executable([ # long time + sage: # long time + sage: (out, err, ret) = test_executable([ ....: "sage", "--gap", "-q"], "Size(SymmetricGroup(5));\n") - sage: out # long time + sage: out '120\n' - sage: err.replace('gap: halving pool size.', '').strip() # long time + sage: err.replace('gap: halving pool size.', '').strip() '' - sage: ret # long time + sage: ret 0 sage: (out, err, ret) = test_executable([ # long time # optional - gdb @@ -551,12 +562,13 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False sage: ret 0 - sage: (out, err, ret) = test_executable(["sage", "--R", "--version"]) # optional - r - sage: out.find("R version ") >= 0 # optional - r + sage: # optional - r + sage: (out, err, ret) = test_executable(["sage", "--R", "--version"]) + sage: out.find("R version ") >= 0 True - sage: err # optional - r + sage: err '' - sage: ret # optional - r + sage: ret 0 sage: (out, err, ret) = test_executable(["sage", "--sqlite3", "--version"]) @@ -569,28 +581,31 @@ def test_executable(args, input="", timeout=100.0, pydebug_ignore_warnings=False Check some things requiring an internet connection:: - sage: (out, err, ret) = test_executable(["sage", "--standard"]) # optional - internet - sage: out.find("cython") >= 0 # optional - internet + sage: # optional - internet + sage: (out, err, ret) = test_executable(["sage", "--standard"]) + sage: out.find("cython") >= 0 True - sage: err # optional - internet + sage: err '' - sage: ret # optional - internet + sage: ret 0 - sage: (out, err, ret) = test_executable(["sage", "--optional"]) # optional - internet - sage: out.find("database_cremona_ellcurve") >= 0 # optional - internet + sage: # optional - internet + sage: (out, err, ret) = test_executable(["sage", "--optional"]) + sage: out.find("database_cremona_ellcurve") >= 0 True - sage: err # optional - internet + sage: err '' - sage: ret # optional - internet + sage: ret 0 - sage: (out, err, ret) = test_executable(["sage", "--experimental"]) # optional - internet - sage: out.find("valgrind") >= 0 # optional - internet + sage: # optional - internet + sage: (out, err, ret) = test_executable(["sage", "--experimental"]) + sage: out.find("valgrind") >= 0 True - sage: err # optional - internet + sage: err '' - sage: ret # optional - internet + sage: ret 0 Check an illegal command line option. This outputs an error to stdout, diff --git a/src/sage/tests/combinatorial_hopf_algebras.py b/src/sage/tests/combinatorial_hopf_algebras.py index 6ac40f7aad5..33c0472f404 100644 --- a/src/sage/tests/combinatorial_hopf_algebras.py +++ b/src/sage/tests/combinatorial_hopf_algebras.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.combinat sage.modules r""" Tests For Combinatorial Hopf Algebras diff --git a/src/sage/tests/finite_poset.py b/src/sage/tests/finite_poset.py index 11092c3d966..e6733ef7f5f 100644 --- a/src/sage/tests/finite_poset.py +++ b/src/sage/tests/finite_poset.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.graphs sage.modules """ This file contains test functions that can be used to search bugs by testing random finite posets and lattices. diff --git a/src/sage/tests/gap_packages.py b/src/sage/tests/gap_packages.py index c302b169b8a..b13bba24a83 100644 --- a/src/sage/tests/gap_packages.py +++ b/src/sage/tests/gap_packages.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.libs.gap """ Test the optional GAP packages diff --git a/src/sage/tests/lazy_imports.py b/src/sage/tests/lazy_imports.py index e9bd2aea2c0..8ea93a15ab5 100644 --- a/src/sage/tests/lazy_imports.py +++ b/src/sage/tests/lazy_imports.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.all r""" TESTS: diff --git a/src/sage/tests/modular_group_cohomology.py b/src/sage/tests/modular_group_cohomology.py index be00146dc6f..35bc8b5387f 100644 --- a/src/sage/tests/modular_group_cohomology.py +++ b/src/sage/tests/modular_group_cohomology.py @@ -1,3 +1,4 @@ +# sage.doctest: optional - p_group_cohomology r""" Tests for the optional ``p_group_cohomology`` package. @@ -7,26 +8,26 @@ TESTS:: - sage: from pGroupCohomology import CohomologyRing # optional - p_group_cohomology + sage: from pGroupCohomology import CohomologyRing Computation of a modular cohomology ring of a prime power group in characteristic 2, and comparison with stored result in a database:: - sage: CohomologyRing.set_workspace(tmp_dir()) # optional - p_group_cohomology - sage: H = CohomologyRing(64,14,from_scratch=True) # optional - p_group_cohomology - sage: H.make() # optional - p_group_cohomology - sage: CohomologyRing.set_workspace(tmp_dir()) # optional - p_group_cohomology - sage: H0 = CohomologyRing(64,14) # optional - p_group_cohomology - sage: H.is_isomorphic(H0) # optional - p_group_cohomology + sage: CohomologyRing.set_workspace(tmp_dir()) + sage: H = CohomologyRing(64,14,from_scratch=True) + sage: H.make() + sage: CohomologyRing.set_workspace(tmp_dir()) + sage: H0 = CohomologyRing(64,14) + sage: H.is_isomorphic(H0) ('1*a_2_1', '1*c_2_2', '1*c_4_4', '1*a_1_0', '1*a_1_1', '1*a_3_3') Computation of a modular cohomology ring of a prime power group in odd characteristic, and some algebraic constructions in the cohomology ring:: - sage: H = CohomologyRing(27,4) # optional - p_group_cohomology - sage: H.make() # optional - p_group_cohomology - sage: print(H) # optional - p_group_cohomology + sage: H = CohomologyRing(27,4) + sage: H.make() + sage: print(H) Cohomology ring of Extraspecial 3-group of order 27 and exponent 9 with coefficients in GF(3) @@ -45,14 +46,14 @@ b_2_1*a_3_1, a_1_0*a_5_1, a_3_1*a_5_1] - sage: H.5.massey_power() # optional - p_group_cohomology + sage: H.5.massey_power() : 8-Cocycle in H^*(M27; GF(3)) - sage: H.5.massey_power().as_polynomial() # optional - p_group_cohomology + sage: H.5.massey_power().as_polynomial() '-c_6_2*a_1_0*a_1_1' - sage: H.essential_ideal() # optional - p_group_cohomology + sage: H.essential_ideal() a_1_0*a_1_1, a_1_1*a_3_1 - sage: ascii_art(H.bar_code('LowerCentralSeries')[2]) # known bug (possibly, the output might be correct) # optional - p_group_cohomology + sage: ascii_art(H.bar_code('LowerCentralSeries')[2]) # known bug * *-* *-* @@ -61,11 +62,11 @@ Computation of a modular cohomology ring of a non prime power group in characteristic 2:: - sage: H = CohomologyRing(libgap.AlternatingGroup(6), # optional - p_group_cohomology + sage: H = CohomologyRing(libgap.AlternatingGroup(6), ....: GroupName="A(6)", prime=2, ....: from_scratch=True) - sage: H.make() # optional - p_group_cohomology - sage: print(H) # optional - p_group_cohomology + sage: H.make() + sage: print(H) Cohomology ring of A(6) with coefficients in GF(2) Computation complete diff --git a/src/sage/tests/numpy.py b/src/sage/tests/numpy.py index 8c1c42f385c..5cd78b148d2 100644 --- a/src/sage/tests/numpy.py +++ b/src/sage/tests/numpy.py @@ -1,3 +1,4 @@ +# sage.doctest: needs numpy r""" TESTS: diff --git a/src/sage/tests/parigp.py b/src/sage/tests/parigp.py index 4692b613de4..85eab45423f 100644 --- a/src/sage/tests/parigp.py +++ b/src/sage/tests/parigp.py @@ -1,3 +1,4 @@ +# sage.doctest: needs sage.libs.pari sage.modules r""" This file is meant to catch errors in the PARI/GP package which are not caught by any other tests. From 66dc5d282e2db6c2770b485bd4caf1c4f6ea1437 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 6 Aug 2023 18:32:57 -0700 Subject: [PATCH 05/15] Update # needs --- src/sage/doctest/fixtures.py | 4 ++-- src/sage/symbolic/function.pyx | 7 ++++--- .../tests/article_heuberger_krenn_kropf_fsm-in-sage.py | 4 ++-- src/sage/tests/book_schilling_zabrocki_kschur_primer.py | 9 +++++---- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/sage/doctest/fixtures.py b/src/sage/doctest/fixtures.py index a3b5e9edda7..9fbfdf86db9 100644 --- a/src/sage/doctest/fixtures.py +++ b/src/sage/doctest/fixtures.py @@ -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' """ diff --git a/src/sage/symbolic/function.pyx b/src/sage/symbolic/function.pyx index 589c500d00d..792d81ebcc9 100644 --- a/src/sage/symbolic/function.pyx +++ b/src/sage/symbolic/function.pyx @@ -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)): diff --git a/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py b/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py index 3828fa50d1c..6f92f85ec17 100644 --- a/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py +++ b/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py @@ -508,14 +508,14 @@ sage: var('y') # optional - sage.symbolic y - sage: def am_entry(trans): # optional - sage.symbolic + sage: def am_entry(trans): ....: return y^add(trans.word_out) / 2 sage: A = W.adjacency_matrix(entry=am_entry) # optional - sage.symbolic Sage example in fsm-in-sage.tex, line 1097:: - sage: latex.matrix_column_alignment('c') # optional - sage.symbolic + sage: latex.matrix_column_alignment('c') Sage example in fsm-in-sage.tex, line 1099:: diff --git a/src/sage/tests/book_schilling_zabrocki_kschur_primer.py b/src/sage/tests/book_schilling_zabrocki_kschur_primer.py index 12bdc5861cf..2d092c45e59 100644 --- a/src/sage/tests/book_schilling_zabrocki_kschur_primer.py +++ b/src/sage/tests/book_schilling_zabrocki_kschur_primer.py @@ -84,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:: From 8b3ae0b6189650a6d841c0cd29f27cdff4ed966f Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 6 Aug 2023 20:45:15 -0700 Subject: [PATCH 06/15] src/sage/tests: Update file-level doctest tag --- src/sage/tests/benchmark.py | 2 +- src/sage/tests/gosper-sum.py | 2 +- src/sage/tests/symbolic-series.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sage/tests/benchmark.py b/src/sage/tests/benchmark.py index 9f8d665e646..9445a3f7633 100644 --- a/src/sage/tests/benchmark.py +++ b/src/sage/tests/benchmark.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.symbolic +# sage.doctest: needs sage.symbolic """ Benchmarks diff --git a/src/sage/tests/gosper-sum.py b/src/sage/tests/gosper-sum.py index 16d195dc71b..84679ac0ff3 100644 --- a/src/sage/tests/gosper-sum.py +++ b/src/sage/tests/gosper-sum.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.symbolic +# sage.doctest: needs sage.symbolic """ Some tests about Gosper sums. diff --git a/src/sage/tests/symbolic-series.py b/src/sage/tests/symbolic-series.py index 4aff094d364..5e53d1e07af 100644 --- a/src/sage/tests/symbolic-series.py +++ b/src/sage/tests/symbolic-series.py @@ -1,4 +1,4 @@ -# sage.doctest: optional - sage.symbolic +# sage.doctest: needs sage.symbolic """ Tests for the fast univariate series expansion in Pynac ------------------------------------------------------- From f173e10bbfafa6dff97d5da42eac55f7211f22b9 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 7 Aug 2023 22:44:23 -0700 Subject: [PATCH 07/15] src/sage/tests: sage -fixdoctests --only-tags --- ...ticle_heuberger_krenn_kropf_fsm-in-sage.py | 46 +++++++++---------- .../book_schilling_zabrocki_kschur_primer.py | 4 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py b/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py index 6f92f85ec17..d0a51a55eff 100644 --- a/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py +++ b/src/sage/tests/article_heuberger_krenn_kropf_fsm-in-sage.py @@ -1,4 +1,4 @@ -# sage.doctest: needs sage.graphs +# sage.doctest: needs sage.graphs sage.modules r""" This file contains doctests of the article :: @@ -506,11 +506,11 @@ Sage example in fsm-in-sage.tex, line 1091:: - sage: var('y') # optional - sage.symbolic + 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) # optional - sage.symbolic + sage: A = W.adjacency_matrix(entry=am_entry) # needs sage.symbolic Sage example in fsm-in-sage.tex, line 1097:: @@ -520,7 +520,7 @@ Sage example in fsm-in-sage.tex, line 1099:: - sage: latex(A) # optional - sage.symbolic + 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 \\ @@ -536,95 +536,95 @@ Sage example in fsm-in-sage.tex, line 1109:: - sage: A1mI = (A.subs(y=1) - A.parent().identity_matrix()) # optional - sage.symbolic - sage: (pi_not_normalized,) = A1mI.left_kernel().basis() # optional - sage.symbolic - sage: pi = pi_not_normalized / pi_not_normalized.norm(p=1) # optional - sage.symbolic + 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) # optional - sage.symbolic + 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]) # optional - sage.symbolic + 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) # optional - sage.symbolic + 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 # optional - sage.symbolic + sage: pi * expected_output # needs sage.symbolic 5/9 Sage example in fsm-in-sage.tex, line 1127:: - sage: latex(pi * expected_output) # optional - sage.symbolic + 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) # optional - sage.symbolic + sage: latex(pi * expected_output) # needs sage.symbolic \frac{5}{9} Sage example in fsm-in-sage.tex, line 1145:: - sage: var('k') # optional - sage.symbolic + sage: var('k') # needs sage.symbolic k - sage: moments = W.asymptotic_moments(k) # optional - sage.symbolic + sage: moments = W.asymptotic_moments(k) # needs sage.symbolic Sage example in fsm-in-sage.tex, line 1155:: - sage: latex(moments['expectation']) # optional - sage.symbolic + 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']) # optional - sage.symbolic + 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'] # optional - sage.symbolic + sage: expectation_binary = Id.asymptotic_moments(k)['expectation'] # needs sage.symbolic Sage example in fsm-in-sage.tex, line 1195:: - sage: latex(expectation_binary) # optional - sage.symbolic + 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'] # optional - sage.symbolic + 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) # optional - sage.symbolic + 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]) # optional - sage.symbolic + sage: Abs = transducers.abs([-1, 0, 1]) # needs sage.symbolic Sage example in fsm-in-sage.tex, line 1216:: - sage: latex(moments['expectation']) # optional - sage.symbolic + sage: latex(moments['expectation']) # needs sage.symbolic \frac{5}{9} \, k + \mathcal{O}\left(1\right) """ diff --git a/src/sage/tests/book_schilling_zabrocki_kschur_primer.py b/src/sage/tests/book_schilling_zabrocki_kschur_primer.py index 2d092c45e59..7b49e6769b1 100644 --- a/src/sage/tests/book_schilling_zabrocki_kschur_primer.py +++ b/src/sage/tests/book_schilling_zabrocki_kschur_primer.py @@ -578,8 +578,8 @@ Sage example in ./kschurnotes/notes-mike-anne.tex, line 4055:: - sage: t = var('t') # optional - sage.symbolic - sage: for mu in Partitions(5): # optional - sage.symbolic + 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 From 72fc063d3849ba8276b2089aa249a2e5c41cb501 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 12 Aug 2023 19:23:47 -0700 Subject: [PATCH 08/15] Update # needs --- src/sage/tests/finite_poset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/tests/finite_poset.py b/src/sage/tests/finite_poset.py index e6733ef7f5f..de92b818bab 100644 --- a/src/sage/tests/finite_poset.py +++ b/src/sage/tests/finite_poset.py @@ -105,7 +105,7 @@ def test_attrcall(name, L): sage: N5 = posets.PentagonPoset() sage: N5.is_modular() == test_attrcall('is_modular', N5) True - sage: N5.is_constructible_by_doublings('convex') == test_attrcall('is_doubling_convex', N5) + sage: N5.is_constructible_by_doublings('convex') == test_attrcall('is_doubling_convex', N5) # needs sage.combinat True """ if name == 'is_doubling_any': From 362e34f98480dcc0a211b31b373dd69759150e55 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 13 Aug 2023 12:31:51 -0700 Subject: [PATCH 09/15] sage --fixdoctests --no-test --- src/sage/tests/finite_poset.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/tests/finite_poset.py b/src/sage/tests/finite_poset.py index de92b818bab..d04221dcc13 100644 --- a/src/sage/tests/finite_poset.py +++ b/src/sage/tests/finite_poset.py @@ -105,7 +105,7 @@ def test_attrcall(name, L): sage: N5 = posets.PentagonPoset() sage: N5.is_modular() == test_attrcall('is_modular', N5) True - sage: N5.is_constructible_by_doublings('convex') == test_attrcall('is_doubling_convex', N5) # needs sage.combinat + sage: N5.is_constructible_by_doublings('convex') == test_attrcall('is_doubling_convex', N5) # needs sage.combinat True """ if name == 'is_doubling_any': From f1951b399e581b901a6a128a15c77143dacfe859 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 27 Aug 2023 13:40:45 -0700 Subject: [PATCH 10/15] Update # needs --- src/sage/ext/fast_callable.pyx | 2 +- src/sage/libs/coxeter3/__init__.py | 1 + src/sage/libs/coxeter3/all__sagemath_coxeter3.py | 1 + src/sage/tests/book_schilling_zabrocki_kschur_primer.py | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sage/ext/fast_callable.pyx b/src/sage/ext/fast_callable.pyx index bad30e0e605..0a1439b7530 100644 --- a/src/sage/ext/fast_callable.pyx +++ b/src/sage/ext/fast_callable.pyx @@ -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)) diff --git a/src/sage/libs/coxeter3/__init__.py b/src/sage/libs/coxeter3/__init__.py index e69de29bb2d..61138b7bc1a 100644 --- a/src/sage/libs/coxeter3/__init__.py +++ b/src/sage/libs/coxeter3/__init__.py @@ -0,0 +1 @@ +# sage_setup: distribution = sagemath-coxeter3 diff --git a/src/sage/libs/coxeter3/all__sagemath_coxeter3.py b/src/sage/libs/coxeter3/all__sagemath_coxeter3.py index e69de29bb2d..61138b7bc1a 100644 --- a/src/sage/libs/coxeter3/all__sagemath_coxeter3.py +++ b/src/sage/libs/coxeter3/all__sagemath_coxeter3.py @@ -0,0 +1 @@ +# sage_setup: distribution = sagemath-coxeter3 diff --git a/src/sage/tests/book_schilling_zabrocki_kschur_primer.py b/src/sage/tests/book_schilling_zabrocki_kschur_primer.py index 7b49e6769b1..4f91b77e036 100644 --- a/src/sage/tests/book_schilling_zabrocki_kschur_primer.py +++ b/src/sage/tests/book_schilling_zabrocki_kschur_primer.py @@ -1,4 +1,4 @@ -# sage.doctest: needs sage.combinat +# 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" From ba7b9f2ed4d2e7b68a82ad610a542a876f005504 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sun, 3 Sep 2023 23:46:22 -0700 Subject: [PATCH 11/15] Add # needs --- src/sage/tests/book_stein_ent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/tests/book_stein_ent.py b/src/sage/tests/book_stein_ent.py index 6d8a7306878..b4d593ff427 100644 --- a/src/sage/tests/book_stein_ent.py +++ b/src/sage/tests/book_stein_ent.py @@ -33,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) From c506b0690a8107e5ecb7ff4bff4d49f5b585d5c1 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 4 Sep 2023 21:55:17 -0700 Subject: [PATCH 12/15] sage.structure: Update # needs --- src/sage/structure/coerce.pyx | 2 ++ src/sage/structure/factorization.py | 7 ++++--- src/sage/structure/parent_old.pyx | 2 +- src/sage/tests/book_stein_modform.py | 2 ++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/sage/structure/coerce.pyx b/src/sage/structure/coerce.pyx index 8eed934aea3..1e7c4dd1a49 100644 --- a/src/sage/structure/coerce.pyx +++ b/src/sage/structure/coerce.pyx @@ -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 diff --git a/src/sage/structure/factorization.py b/src/sage/structure/factorization.py index 00571876e39..00ad9658e59 100644 --- a/src/sage/structure/factorization.py +++ b/src/sage/structure/factorization.py @@ -1232,9 +1232,10 @@ def __call__(self, *args, **kwds): sage: F(t=0) 0 - sage: R. = 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. = LaurentPolynomialRing(QQ, 1) + sage: F = ((x+2)/x**3).factor() + sage: F(x=4) 1/64 * 6 """ unit = self.__unit.subs(*args, **kwds) diff --git a/src/sage/structure/parent_old.pyx b/src/sage/structure/parent_old.pyx index c093febf375..c2afaa89000 100644 --- a/src/sage/structure/parent_old.pyx +++ b/src/sage/structure/parent_old.pyx @@ -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] diff --git a/src/sage/tests/book_stein_modform.py b/src/sage/tests/book_stein_modform.py index 56ee188cd50..06e9717ded1 100644 --- a/src/sage/tests/book_stein_modform.py +++ b/src/sage/tests/book_stein_modform.py @@ -5,6 +5,7 @@ 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() @@ -14,6 +15,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) From 2a84d764aa25727305cc43eaae5208ba381cfc6a Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Fri, 8 Sep 2023 22:59:40 -0700 Subject: [PATCH 13/15] sage.tests: Update # needs --- src/sage/tests/book_stein_modform.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/sage/tests/book_stein_modform.py b/src/sage/tests/book_stein_modform.py index 06e9717ded1..667bb057c70 100644 --- a/src/sage/tests/book_stein_modform.py +++ b/src/sage/tests/book_stein_modform.py @@ -1,4 +1,5 @@ -# sage.doctest: needs sage.modular +# 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. From 3df8c81ab25b71785cc31ae53442d750d2cd58c4 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Sat, 9 Sep 2023 13:27:47 -0700 Subject: [PATCH 14/15] sage.tests: Update # needs --- src/sage/tests/parigp.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/sage/tests/parigp.py b/src/sage/tests/parigp.py index 85eab45423f..1049149a147 100644 --- a/src/sage/tests/parigp.py +++ b/src/sage/tests/parigp.py @@ -40,32 +40,35 @@ Check that the optional PARI databases work:: - sage: gp.ellinit('"299998a1"') # optional -- pari_elldata + sage: # optional - pari_elldata + sage: gp.ellinit('"299998a1"') [1, 0, 1, 110, -3660, ...] - sage: E = EllipticCurve("1728ba1") - sage: gp(E).ellidentify() # optional -- pari_elldata + sage: E = EllipticCurve("1728ba1") # needs sage.schemes + sage: gp(E).ellidentify() # needs sage.schemes [["1728ba1", [0, 0, 0, -6, 6], [[1, 1]]], [1, 0, 0, 0]] - sage: pari("ellmodulareqn(211)") # optional -- pari_seadata - [x^212 + (-y^7 + 5207*y^6 - 10241606*y^5 + 9430560101*y^4 - 4074860204015*y^3 + 718868274900397*y^2 - 34897101275826114*y + 104096378056356968)*x^211... + sage: pari("ellmodulareqn(211)") # optional - pari_seadata + [x^212 + (-y^7 + 5207*y^6 - 10241606*y^5 + 9430560101*y^4 - 4074860204015*y^3 + + 718868274900397*y^2 - 34897101275826114*y + 104096378056356968)*x^211... The following requires the modular polynomials up to degree 223, while only those up to degree 199 come standard in Sage:: sage: p = next_prime(2^328) - sage: E = EllipticCurve(GF(p), [6,1]) - sage: E.cardinality() # long time (108s on sage.math, 2013), optional -- pari_seadata + sage: E = EllipticCurve(GF(p), [6,1]) # needs sage.schemes + sage: E.cardinality() # long time (108s on sage.math, 2013), optional - pari_seadata, needs sage.schemes 546812681195752981093125556779405341338292357723293496548601032930284335897180749997402596957976244 Create a number field with Galois group `A4`. Group `A4` corresponds to transitive group `(12,3)` in GAP:: + sage: # optional - pari_galpol sage: R. = PolynomialRing(ZZ) - sage: pol = pari("galoisgetpol(12,3)[1]") # optional -- pari_galpol - sage: K. = NumberField(R(pol)) # optional -- pari_galpol - sage: factor(K.discriminant()) # optional -- pari_galpol + sage: pol = pari("galoisgetpol(12,3)[1]") + sage: K. = NumberField(R(pol)) + sage: factor(K.discriminant()) 163^8 - sage: [F.degree() for F,a,b in K.subfields()] # optional -- pari_galpol + sage: [F.degree() for F,a,b in K.subfields()] [1, 3, 4, 4, 4, 4, 6, 6, 6, 12] sage: sorted([12/H.cardinality() for H in AlternatingGroup(4).subgroups()]) [1, 3, 4, 4, 4, 4, 6, 6, 6, 12] From 71331829d84dc26b2c914d2ad5e1edc70e194d46 Mon Sep 17 00:00:00 2001 From: Matthias Koeppe Date: Mon, 6 Nov 2023 08:03:05 -0800 Subject: [PATCH 15/15] src/sage/tests/book_stein_ent.py: Use block tag --- src/sage/tests/book_stein_ent.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/sage/tests/book_stein_ent.py b/src/sage/tests/book_stein_ent.py index b4d593ff427..2c43a840cdc 100644 --- a/src/sage/tests/book_stein_ent.py +++ b/src/sage/tests/book_stein_ent.py @@ -50,12 +50,14 @@ 25 sage: prime_pi(3000000) 216816 -sage: plot(prime_pi, 1,1000, rgbcolor=(0,0,1)) # needs sage.plot + +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') # needs sage.plot -sage: Q = plot(prime_pi, 2,10000, rgbcolor='black') # needs sage.plot -sage: R = plot(sqrt(x)*log(x),2,10000,rgbcolor='red') # needs sage.plot -sage: show(P+Q+R,xmin=0, figsize=[8,3]) # needs sage.plot +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 = Integers(3) sage: list(R)