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

Meta-ticket: Fix unstable random doctests detected after #29935 #32544

Open
kliem opened this issue Sep 21, 2021 · 43 comments
Open

Meta-ticket: Fix unstable random doctests detected after #29935 #32544

kliem opened this issue Sep 21, 2021 · 43 comments

Comments

@kliem
Copy link
Contributor

kliem commented Sep 21, 2021

Component: doctest framework

Issue created by migration from https://trac.sagemath.org/ticket/32544

@kliem kliem added this to the sage-9.5 milestone Sep 21, 2021
@jhpalmieri
Copy link
Member

comment:1

I see failures

./sage -t --long --warn-long 101.7 --random-seed=260367842280804525169259077536186393366 src/sage/modular/modform/numerical.py

In detail

Doctesting 1 file.
sage -t --long --warn-long 101.7 --random-seed=260367842280804525169259077536186393366 src/sage/modular/modform/numerical.py
**********************************************************************
File "src/sage/modular/modform/numerical.py", line 74, in sage.modular.modform.numerical.NumericalEigenforms
Failed example:
    n.ap(2)  # rel tol 2e-14
Expected:
    [3.0, -1.6180339887498947, 0.6180339887498968]
Got:
    [3.0, -1.6180339887498947, 0.6180339887498804]
Tolerance exceeded in 1 of 3:
    0.6180339887498968 vs 0.6180339887498804, tolerance 3e-14 > 2e-14
**********************************************************************
File "src/sage/modular/modform/numerical.py", line 76, in sage.modular.modform.numerical.NumericalEigenforms
Failed example:
    n.systems_of_eigenvalues(7)  # rel tol 2e-14
Expected:
    [
    [-1.6180339887498947, 2.2360679774997894, -3.2360679774997894],
    [0.6180339887498968, -2.236067977499788, 1.2360679774997936],
    [3.0, 4.0, 6.0]
    ]
Got:
    [
    [-1.6180339887498947, 2.2360679774997894, -3.2360679774997894],
    [0.6180339887498804, -2.2360679774998293, 1.2360679774997607],
    [3.0, 4.0, 6.0]
    ]
Tolerance exceeded in 2 of 9:
    0.6180339887498968 vs 0.6180339887498804, tolerance 3e-14 > 2e-14
    1.2360679774997936 vs 1.2360679774997607, tolerance 3e-14 > 2e-14
**********************************************************************
File "src/sage/modular/modform/numerical.py", line 88, in sage.modular.modform.numerical.NumericalEigenforms
Failed example:
    n.eigenvalues([2,3,5])  # rel tol 2e-14
Expected:
    [[3.0, -1.6180339887498947, 0.6180339887498968],
     [4.0, 2.2360679774997894, -2.236067977499788],
     [6.0, -3.2360679774997894, 1.2360679774997936]]
Got:
    [[3.0, -1.6180339887498947, 0.6180339887498804],
     [4.0, 2.2360679774997894, -2.2360679774998293],
     [6.0, -3.2360679774997894, 1.2360679774997607]]
Tolerance exceeded in 2 of 9:
    0.6180339887498968 vs 0.6180339887498804, tolerance 3e-14 > 2e-14
    1.2360679774997936 vs 1.2360679774997607, tolerance 3e-14 > 2e-14
**********************************************************************
1 item had failures:
   3 of   7 in sage.modular.modform.numerical.NumericalEigenforms
    [46 tests, 3 failures, 0.26 s]
----------------------------------------------------------------------
sage -t --long --warn-long 101.7 --random-seed=260367842280804525169259077536186393366 src/sage/modular/modform/numerical.py  # 3 doctests failed

@kliem

This comment has been minimized.

@kliem
Copy link
Contributor Author

kliem commented Oct 26, 2021

comment:3
sage -t --long --random-seed=180924489930967511277954046005685261728 src/sage/graphs/base/sparse_graph.pyx
**********************************************************************
File "src/sage/graphs/base/sparse_graph.pyx", line 1163, in sage.graphs.base.sparse_graph._test_adjacency_sequence_out
Failed example:
    _test_adjacency_sequence_out()  # long time
Exception raised:
    Traceback (most recent call last):
      File "/home/jonathan/Applications/sage/local/lib/python3.8/site-packages/sage/doctest/forker.py", line 694, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/jonathan/Applications/sage/local/lib/python3.8/site-packages/sage/doctest/forker.py", line 1088, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.graphs.base.sparse_graph._test_adjacency_sequence_out[1]>", line 1, in <module>
        _test_adjacency_sequence_out()  # long time
      File "sage/graphs/base/sparse_graph.pyx", line 1189, in sage.graphs.base.sparse_graph._test_adjacency_sequence_out (build/cythonized/sage/graphs/base/sparse_graph.c:9302)
        u = randint(low, n - 1)
      File "/home/jonathan/Applications/sage/local/lib/python3.8/site-packages/sage/misc/prandom.py", line 137, in randint
        return _pyrand().randint(a, b)
      File "/home/jonathan/Applications/sage/local/lib/python3.8/site-packages/sage/cpython/_py2_random.py", line 220, in randint
        return self.randrange(a, b+1)
      File "/home/jonathan/Applications/sage/local/lib/python3.8/site-packages/sage/cpython/_py2_random.py", line 195, in randrange
        raise ValueError("empty range for randrange() (%d,%d, %d)" %
    ValueError: empty range for randrange() (0,0, 0)
sage -t --long --random-seed=180924489930967511277954046005685261728 src/sage/graphs/generators/families.py
**********************************************************************
File "src/sage/graphs/generators/families.py", line 1477, in sage.graphs.generators.families.FriendshipGraph
Failed example:
    G.diameter()
Expected:
    2
Got:
    1

@kliem
Copy link
Contributor Author

kliem commented Oct 26, 2021

comment:4
sage -t --long --random-seed=23747002002644886606785003174022326205 src/sage/modules/free_module_integer.py
**********************************************************************
File "src/sage/modules/free_module_integer.py", line 370, in sage.modules.free_module_integer.FreeModule_submodule_with_basis_integer.LLL
Failed example:
    new_min <= old_min
Expected:
    True
Got:
    False

sage -t --long --random-seed=23747002002644886606785003174022326205 src/sage/schemes/toric/sheaf/klyachko.py
**********************************************************************
File "src/sage/schemes/toric/sheaf/klyachko.py", line 951, in sage.schemes.toric.sheaf.klyachko.KlyachkoBundle_class.random_deformation
Failed example:
    Vtilde.cohomology(dim=True, weight=(0,))
Expected:
    (1, 0)
Got:
    (0, 0)

@kliem
Copy link
Contributor Author

kliem commented Oct 26, 2021

comment:5
sage -t --long --random-seed=77478494819088915365500074763386376542 src/sage/rings/continued_fraction.py
**********************************************************************
File "src/sage/rings/continued_fraction.py", line 265, in sage.rings.continued_fraction.rat_interval_cf_list
Failed example:
    for prec in range(10,54):
        R = RealIntervalField(20)
        for _ in range(100):
            x = R.random_element() * R.random_element() + R.random_element() / 100
            l = x.lower().exact_rational()
            u = x.upper().exact_rational()
            cf = rat_interval_cf_list(l,u)
            a = continued_fraction(cf).value()
            b = continued_fraction(cf+[1]).value()
            if a > b:
                a,b = b,a
            assert a <= l
            assert b >= u
Exception raised:
    Traceback (most recent call last):
      File "/home/jonathan/Applications/sage/local/lib/python3.8/site-packages/sage/doctest/forker.py", line 694, in _run
        self.compile_and_execute(example, compiler, test.globs)
      File "/home/jonathan/Applications/sage/local/lib/python3.8/site-packages/sage/doctest/forker.py", line 1088, in compile_and_execute
        exec(compiled, globs)
      File "<doctest sage.rings.continued_fraction.rat_interval_cf_list[2]>", line 8, in <module>
        a = continued_fraction(cf).value()
      File "/home/jonathan/Applications/sage/local/lib/python3.8/site-packages/sage/rings/continued_fraction.py", line 2625, in continued_fraction
        x1, x2 = check_and_reduce_pair(x)
      File "/home/jonathan/Applications/sage/local/lib/python3.8/site-packages/sage/rings/continued_fraction.py", line 2254, in check_and_reduce_pair
        raise ValueError("continued fraction can not represent infinity")
    ValueError: continued fraction can not represent infinity
**********************************************************************
1 item had failures:
   1 of   4 in sage.rings.continued_fraction.rat_interval_cf_list
    [437 tests, 1 failure, 5.09 s]
-------------------------------------------------------------

@kliem
Copy link
Contributor Author

kliem commented Oct 26, 2021

comment:6

Created tickets for reported failures so far.

@kliem

This comment has been minimized.

@yyyyx4

This comment has been minimized.

@mkoeppe
Copy link
Contributor

mkoeppe commented Oct 28, 2021

comment:8

Seen in https://patchbot.sagemath.org/log/32777/Linux/1_SMP_Debian_5.10.70-1_(2021-09-30)/x86_64/5.10.0-9-amd64/tmonteil-lxc1/2021-10-27%2001:20:12

sage -t --long --random-seed=321172385432269463934777057410284981568 src/sage/rings/polynomial/multi_polynomial_ring_base.pyx
**********************************************************************
File "src/sage/rings/polynomial/multi_polynomial_ring_base.pyx", line 994, in sage.rings.polynomial.multi_polynomial_ring_base.MPolynomialRing_base.random_element
Failed example:
    len(list(f))
Expected:
    1
Got:
    0

@mkoeppe
Copy link
Contributor

mkoeppe commented Oct 28, 2021

comment:9

From https://patchbot.sagemath.org/log/32762/Linux/1_SMP_Debian_5.10.70-1_(2021-09-30)/x86_64/5.10.0-9-amd64/tmonteil-lxc1/2021-10-25%2015:13:58

sage -t --long --random-seed=324642231642420052385517156149041216749 src/sage/dynamics/arithmetic_dynamics/projective_ds.py
**********************************************************************
File "src/sage/dynamics/arithmetic_dynamics/projective_ds.py", line 7076, in sage.dynamics.arithmetic_dynamics.projective_ds.?.conjugating_set
Failed example:
    D6.conjugating_set(D6)
Expected:
    [
    [1 0]  [0 1]  [0 2]  [4 0]  [2 0]  [0 4]
    [0 1], [1 0], [1 0], [0 1], [0 1], [1 0]
    ]
Got:
    [
    [4 0]  [2 0]  [0 4]  [1 0]  [0 1]  [0 2]
    [0 1], [0 1], [1 0], [0 1], [1 0], [1 0]
    ]

@yyyyx4

This comment has been minimized.

@kliem

This comment has been minimized.

@kliem
Copy link
Contributor Author

kliem commented Nov 3, 2021

comment:11

Created tickets for reported failures so far.

@yyyyx4

This comment has been minimized.

@yyyyx4

This comment has been minimized.

@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@kliem

This comment has been minimized.

@yyyyx4

This comment has been minimized.

@yyyyx4

This comment has been minimized.

@kliem

This comment has been minimized.

@slel
Copy link
Member

slel commented Dec 29, 2021

@slel slel changed the title Meta-ticket: Fix unstable doctests detected after #29935 Meta-ticket: Fix unstable random doctests detected after #29935 Dec 29, 2021
@orlitzky

This comment has been minimized.

@fchapoton
Copy link
Contributor

comment:23

bump to 9.6

@fchapoton fchapoton removed this from the sage-9.5 milestone Jan 29, 2022
@jhpalmieri

This comment has been minimized.

@jhpalmieri
Copy link
Member

comment:37

Replying to David Coudert:

with sage 9.8.beta3

sage -t --long --warn-long 41.8 --random-seed=133497414867200611466007568756298202280 src/sage/homology/tests.py
**********************************************************************
File "src/sage/homology/tests.py", line 50, in sage.homology.tests.random_chain_complex
Failed example:
    C
Expected:
    Chain complex with at most ... nonzero terms over Integer Ring
Got:
    Trivial chain complex over Integer Ring
**********************************************************************
File "src/sage/homology/tests.py", line 52, in sage.homology.tests.random_chain_complex
Failed example:
    len(C.nonzero_degrees()) in [1, 2]
Expected:
    True
Got:
    False
**********************************************************************

I have a fix in #34762.

@yyyyx4

This comment has been minimized.

@yyyyx4

This comment has been minimized.

@fchapoton

This comment has been minimized.

@mkoeppe mkoeppe removed this from the sage-9.8 milestone Jan 29, 2023
vbraun pushed a commit that referenced this issue Feb 12, 2023
…group_theory.rst

Part of #32544:

{{{
sage -t --long --random-seed=185470747385175316039405094141387664605
src/doc/en/thematic_tutorials/group_theory.rst
**********************************************************************
File "src/doc/en/thematic_tutorials/group_theory.rst", line 207, in
doc.en.thematic_tutorials.group_theory
Failed example:
    euler_phi(m*n) == euler_phi(m) * euler_phi(n)
Expected:
    True
Got:
    False
**********************************************************************
1 item had failures:
   1 of 170 in doc.en.thematic_tutorials.group_theory
    [127 tests, 1 failure, 4.40 s]
}}}

(From a patchbot run in #34880.)

URL: https://trac.sagemath.org/34901
Reported by: lorenz
Ticket author(s): Frédéric Chapoton
Reviewer(s): Lorenz Panny
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants