Make rings doctests ready for random seeds
Closed this issue · 53 comments
This ticket makes
sage -t --long --random-seed=n src/sage/rings/
pass for different values n than just 0.
Depends on #32084
Depends on #32109
Depends on #32117
Depends on #32124
Component: doctest framework
Author: Jonathan Kliem
Branch/Commit: 3ddf396
Reviewer: Markus Wageringel
Issue created by migration from https://trac.sagemath.org/ticket/29979
I have a partial fix. After that at least the following need fixes:
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/complex_double.pyx # 3 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/complex_field.py # 4 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/complex_interval_field.py # 3 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/finite_rings/element_givaro.pyx # 2 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/finite_rings/element_ntl_gf2e.pyx # 2 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/finite_rings/finite_field_base.pyx # 1 doctest failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/finite_rings/finite_field_givaro.py # 2 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/finite_rings/finite_field_ntl_gf2e.py # 2 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/finite_rings/integer_mod_ring.py # 1 doctest failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/integer_ring.pyx # 10 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/number_field/order.py # 1 doctest failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/padics/generic_nodes.py # 3 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/padics/padic_extension_generic.py # 4 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/padics/tests.py # 1 doctest failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/pari_ring.py # 3 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/polynomial/cyclotomic.pyx # 1 doctest failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/polynomial/multi_polynomial_element.py # 1 doctest failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/polynomial/multi_polynomial_ideal.py # 5 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/polynomial/multi_polynomial_ring_base.pyx # 13 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/polynomial/pbori.pyx # 27 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/polynomial/polynomial_element.pyx # 4 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/polynomial/polynomial_quotient_ring.py # 1 doctest failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/polynomial/polynomial_ring.py # 7 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/polynomial/skew_polynomial_element.pyx # 15 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/rational_field.py # 6 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/real_double.pyx # 2 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/real_mpfi.pyx # 5 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/real_mpfr.pyx # 12 doctests failed
sage -t --long --random-seed=151058820726654196682836430928254760259 src/sage/rings/ring.pyx # 1 doctest failed
Branch: public/29979
Setting new milestone based on a cursory review of ticket status, priority, and last modification date.
Branch pushed to git repo; I updated commit sha1. This was a forced push. New commits:
a03aebb | make some files of rings fuzz ready |
e92d0a6 | some changes to make rings fuzz ready |
8d93480 | make rings ready for fuzzed doctests |
f008269 | add ticket numbers to `not tested` |
540413e | fix various remaining doctests in rings |
2a3eebb | a few more doctests |
Author: Jonathan Kliem
If a reviewer feels like we should split this into several tickets, then this is also fine with me (e.g. start with some submodules).
Branch pushed to git repo; I updated commit sha1. New commits:
5c027a7 | get a random nonzero element |
Branch pushed to git repo; I updated commit sha1. New commits:
6d56c0a | remove bug tag as bug has been resolved in 32084 |
Branch pushed to git repo; I updated commit sha1. New commits:
74c2425 | two more failing tests for rings |
There are a few more tests that fail (some of these might be duplicates):
sage -t --long --warn-long 62.5 --random-seed=3000 src/sage/rings/tate_algebra_element.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3000 src/sage/rings/tests.py # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3002 src/sage/rings/finite_rings/integer_mod.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3002 src/sage/rings/padics/padic_generic_element.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3003 src/sage/rings/finite_rings/integer_mod.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3004 src/sage/rings/finite_rings/integer_mod.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3007 src/sage/rings/polynomial/ore_function_field.py # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3009 src/sage/rings/polynomial/ore_polynomial_element.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3009 src/sage/rings/tests.py # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3011 src/sage/rings/polynomial/ore_function_element.py # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3012 src/sage/rings/finite_rings/integer_mod.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3013 src/sage/rings/continued_fraction.py # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3014 src/sage/rings/finite_rings/integer_mod.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3017 src/sage/rings/invariants/invariant_theory.py # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3019 src/sage/rings/finite_rings/integer_mod.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3023 src/sage/rings/finite_rings/integer_mod.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3028 src/sage/rings/padics/padic_generic_element.pyx # 2 doctests failed
sage -t --long --warn-long 62.5 --random-seed=3030 src/sage/rings/tests.py # 7 doctests failed
sage -t --long --warn-long 62.5 --random-seed=3031 src/sage/rings/finite_rings/integer_mod.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3035 src/sage/rings/finite_rings/integer_mod.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3037 src/sage/rings/finite_rings/integer_mod.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3040 src/sage/rings/finite_rings/integer_mod.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3042 src/sage/rings/padics/padic_generic_element.pyx # 2 doctests failed
sage -t --long --warn-long 62.5 --random-seed=3043 src/sage/rings/finite_rings/integer_mod.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3043 src/sage/rings/invariants/invariant_theory.py # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3043 src/sage/rings/polynomial/ore_function_element.py # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3049 src/sage/rings/tate_algebra_element.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3050 src/sage/rings/finite_rings/integer_mod.pyx # 1 doctest failed
sage -t --long --warn-long 62.5 --random-seed=3050 src/sage/rings/padics/padic_generic_element.pyx # 1 doctest failed
Thanks for catching those. It's really hard to catch all those one in a thousand failures in all of sage...
And some of the errors are really something.
In src/sage/rings/tests.py we are trying to construct a relative number field by only checking that the polynomial is irreducible over ZZ...
Last 10 new commits:
0994f0f | trac 32084 fix nth root |
226fe84 | trac 32084 fix nth root |
e280083 | Merge branch 'public/32084r2' of git://trac.sagemath.org/sage into public/29979-reb |
9e53965 | fix 0/0 in ore function field |
192b564 | add ticked number to test |
b20059c | Merge branch 'public/32109' of git://trac.sagemath.org/sage into public/29979-reb |
ce98d48 | two more doctests |
34a233d | pull in 32117 |
cfe869b | modulo n better be for n > 0 |
3752b9c | some more remaining tests |
Changed branch from public/29979 to public/29979-reb
Branch pushed to git repo; I updated commit sha1. New commits:
be3e05f | 29979: a few more fixes |
Replying to @kliem:
It's really hard to catch all those one in a thousand failures in all of sage...
I agree and I appreciate all the work you put into this a lot. In the last commit, I have just added a few small fixes for some other test failures I found.
The continue_fraction_gosper.py doctest sometimes fails for negative period as well. I'm not sure if this is a bug or just the doctest being incorrect::
sage: def foo(a, b, c, d):
....: from sage.rings.continued_fraction_gosper import gosper_iterator
....: x = continued_fraction(([1,2],[3,4])); i = iter(gosper_iterator(a,b,c,d,x))
....: l = list(i)
....: preperiod_length = i.output_preperiod_length
....: preperiod = l[:preperiod_length]
....: period = [abs(w) for w in l[preperiod_length:]]
....: c == d == 0 or continued_fraction((preperiod, period), x.value()) == continued_fraction((a*x.value()+b)/(c*x.value()+d))
sage: for i in range(-10, 11):
....: for j in range(-10, 11):
....: try:
....: foo(0,0,i,j)
....: except:
....: print("foo(0, 0, %s, %s)" % (i, j))
....:
....:
foo(0, 0, -9, 10)
foo(0, 0, -8, 9)
foo(0, 0, -8, 10)
foo(0, 0, -7, 8)
foo(0, 0, -7, 9)
foo(0, 0, -7, 10)
foo(0, 0, -6, 7)
foo(0, 0, -6, 8)
foo(0, 0, -6, 9)
foo(0, 0, -5, 6)
foo(0, 0, -5, 7)
foo(0, 0, -4, 5)
foo(0, 0, -4, 6)
foo(0, 0, -3, 4)
foo(0, 0, -2, 3)
foo(0, 0, 2, -3)
foo(0, 0, 3, -4)
foo(0, 0, 4, -6)
foo(0, 0, 4, -5)
foo(0, 0, 5, -7)
foo(0, 0, 5, -6)
foo(0, 0, 6, -9)
foo(0, 0, 6, -8)
foo(0, 0, 6, -7)
foo(0, 0, 7, -10)
foo(0, 0, 7, -9)
foo(0, 0, 7, -8)
foo(0, 0, 8, -10)
foo(0, 0, 8, -9)
foo(0, 0, 9, -10)
Branch pushed to git repo; I updated commit sha1. New commits:
5f0f5dc | 29979: mark failing tests as not tested |
Replying to @kliem:
The
continue_fraction_gosper.pydoctest sometimes fails for negative period as well. I'm not sure if this is a bug or just the doctest being incorrect::
I am not sure either. I have opened #32127 for this problem and have now marked this test as well as the other tests for which I opened tickets yesterday as not tested.
Branch pushed to git repo; I updated commit sha1. New commits:
bc1e14a | 29979: minor tweaks of doctests |
Reviewer: Markus Wageringel
I have now reviewed your code and made a few small adjustments. The line I removed in multi_polynomial_ring_base seems redundant since R is the base ring of S, but I think the test might have failed if f happened to be zero.
Do you agree with my changes? It is inevitable that there are still sporadic failures, but to me the current branch seems robust enough for now. Nice work.
Thanks for the improvements.
So we can set this ticket to positive then.
Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. New commits:
5330692 | minor style error |
Thank you.
Merge conflict
Changed branch from public/29979-reb to public/29979-reb2
Changed branch from public/29979-reb2 to 3ddf396