Skip to content

Commit 640610a

Browse files
author
Matthias Koeppe
committed
sage.{homology,matrix,modules}: Protect timing out doctests from probing
1 parent 786d6a4 commit 640610a

File tree

6 files changed

+21
-10
lines changed

6 files changed

+21
-10
lines changed

src/sage/homology/homology_group.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ def HomologyGroup(n, base_ring, invfac=None):
165165
Multiplicative Abelian group isomorphic to Z x Z x Z x Z
166166
sage: HomologyGroup(4, ZZ)
167167
Z x Z x Z x Z
168+
169+
sage: # needs sage.libs.flint (otherwise timeout)
168170
sage: HomologyGroup(100, ZZ)
169171
Z^100
170172
"""

src/sage/matrix/constructor.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,8 @@ def matrix(*args, **kwds):
579579
580580
Check :trac:`24459`::
581581
582-
sage: Matrix(ZZ, sys.maxsize, sys.maxsize) # needs sage.libs.flint
582+
sage: # needs sage.libs.flint
583+
sage: Matrix(ZZ, sys.maxsize, sys.maxsize)
583584
Traceback (most recent call last):
584585
...
585586
RuntimeError...

src/sage/matrix/special.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,19 +365,21 @@ def random_matrix(ring, nrows, ncols=None, algorithm='randomize', implementation
365365
sage: while abs(density_sum/total_count - expected_density) > 0.001:
366366
....: add_sample(ZZ, 5, x=-10, y=10, density=0.75)
367367
368+
sage: # needs sage.libs.flint (otherwise timeout)
368369
sage: density_sum = 0.0
369370
sage: total_count = 0.0
370371
sage: add_sample(ZZ, 5, x=20, y=30, density=0.75)
371-
sage: while abs(density_sum/total_count - expected_density) > 0.001: # needs sage.libs.flint
372+
sage: while abs(density_sum/total_count - expected_density) > 0.001:
372373
....: add_sample(ZZ, 5, x=20, y=30, density=0.75)
373374
375+
sage: # needs sage.libs.flint (otherwise timeout)
374376
sage: density_sum = 0.0
375377
sage: total_count = 0.0
376-
sage: add_sample(ZZ, 100, x=20, y=30, density=0.75) # needs sage.libs.flint
378+
sage: add_sample(ZZ, 100, x=20, y=30, density=0.75)
377379
sage: expected_density = (1 - (99/100)^75)
378380
sage: float(expected_density)
379381
0.529...
380-
sage: while abs(density_sum/total_count - expected_density) > 0.001: # needs sage.libs.flint
382+
sage: while abs(density_sum/total_count - expected_density) > 0.001:
381383
....: add_sample(ZZ, 100, x=20, y=30, density=0.75)
382384
383385
For a matrix with low density it may be advisable to insist on a sparse
@@ -393,7 +395,8 @@ def random_matrix(ring, nrows, ncols=None, algorithm='randomize', implementation
393395
For algorithm testing you might want to control the number of bits,
394396
say 10,000 entries, each limited to 16 bits. ::
395397
396-
sage: A = random_matrix(ZZ, 100, 100, x=2^16); A # needs sage.libs.flint
398+
sage: # needs sage.libs.flint (otherwise timeout)
399+
sage: A = random_matrix(ZZ, 100, 100, x=2^16); A
397400
100 x 100 dense matrix over Integer Ring (use the '.str()' method to see the entries)
398401
399402
One can prescribe a specific matrix implementation::

src/sage/modules/fg_pid/fgp_module.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,7 +1867,9 @@ def construction(self):
18671867
sage: T2 = A2 / B2
18681868
sage: t1 = T1.an_element()
18691869
sage: t2 = T2.an_element()
1870-
sage: t1 + t2 # needs sage.libs.flint (o/w infinite recursion)
1870+
1871+
sage: # needs sage.libs.flint (o/w infinite recursion)
1872+
sage: t1 + t2
18711873
(1, 1)
18721874
"""
18731875
from sage.modules.module_functors import QuotientModuleFunctor
@@ -2068,8 +2070,10 @@ def _test_morphism_0(*args, **kwds):
20682070
sage: set_random_seed(s); v = [fgp._test_morphism_0(1) for _ in range(30)]
20692071
sage: set_random_seed(s); v = [fgp._test_morphism_0(2) for _ in range(30)]
20702072
sage: set_random_seed(s); v = [fgp._test_morphism_0(3) for _ in range(10)]
2071-
sage: set_random_seed(s); v = [fgp._test_morphism_0(i) for i in range(1,20)] # needs sage.libs.flint (o/w timeout)
2072-
sage: set_random_seed(s); v = [fgp._test_morphism_0(4) for _ in range(50)] # long time, needs sage.libs.flint
2073+
2074+
sage: # needs sage.libs.flint (o/w timeout)
2075+
sage: set_random_seed(s); v = [fgp._test_morphism_0(i) for i in range(1,20)]
2076+
sage: set_random_seed(s); v = [fgp._test_morphism_0(4) for _ in range(50)] # long time
20732077
"""
20742078
phi = random_fgp_morphism_0(*args, **kwds)
20752079
K = phi.kernel()

src/sage/modules/free_module_integer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def BKZ(self, *args, **kwds):
407407
408408
EXAMPLES::
409409
410-
sage: # needs sage.libs.flint
410+
sage: # needs sage.libs.flint (o/w timeout)
411411
sage: from sage.modules.free_module_integer import IntegerLattice
412412
sage: A = sage.crypto.gen_lattice(type='random', n=1, m=60, q=2^60, seed=42)
413413
sage: L = IntegerLattice(A, lll_reduce=False)

src/sage/modules/free_quadratic_module_integer_symmetric.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1048,8 +1048,9 @@ def maximal_overlattice(self, p=None):
10481048
10491049
TESTS::
10501050
1051+
sage: # needs sage.libs.flint (otherwise timeout)
10511052
sage: L = IntegralLattice(matrix.diagonal([2,4,4,8]))
1052-
sage: L.maximal_overlattice().is_even() # needs sage.libs.flint
1053+
sage: L.maximal_overlattice().is_even()
10531054
True
10541055
10551056
"""

0 commit comments

Comments
 (0)