#5816: [with patch; needs review] doctesting -- make it possible run doctests in
order from file, in random order, and in random seeded order
-------------------------+--------------------------------------------------
Reporter: was | Owner: mabshoff
Type: enhancement | Status: new
Priority: major | Milestone: sage-3.4.1
Component: doctest | Keywords:
-------------------------+--------------------------------------------------
Comment(by was):
With -rand=1 we get the following failures, that are slightly different
than the above
{{{
It's very interesting to run on the full rc3 tree with a fixed random
seed. I think this
reveals *numerous* errors and subtle problems:
./sage -tp 20 -long -rand=1 devel/sage/sage/ > testlong-rand1.log&
This already turns up the following *interesting* problems:
sage -t -long -rand=1 devel/sage/sage/modular/modform/space.py
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/modular/modform/space.py", line 763:
sage: M.q_expansion_basis()
Expected:
[
q - 2*q^2 - q^3 + 2*q^4 + q^5 + O(q^6),
1 + 12/5*q + 36/5*q^2 + 48/5*q^3 + 84/5*q^4 + 72/5*q^5 + O(q^6)
]
Got:
[
q - 2*q^2 - q^3 + 2*q^4 + q^5 + 2*q^6 - 2*q^7 - 2*q^9 - 2*q^10 + q^11
- 2*q^12 + 4*q^13 + O(q^14),
1 + 12/5*q + 36/5*q^2 + 48/5*q^3 + 84/5*q^4 + 72/5*q^5 + 144/5*q^6 +
96/5*q^7 + 36*q^8 + 156/5*q^9 + 216/5*q^10 + 12/5*q^11 + 336/5*q^12 +
168/5*q^13 + O(q^14)
]
**********************************************************************
1 items had failures:
1 of 5 in __main__.example_3297184748
sage -t -long -rand=1 devel/sage/sage/misc/latex.py
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/misc/latex.py", line 62:
sage: latex([1,2,3])
Expected:
\left[1,
[[everything breaks as you know]]
sage -t -long -rand=1 devel/sage/sage/libs/pari/gen.pyx
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/libs/pari/gen.pyx", line 8280:
sage: a = pari('1.2'); a, a.type(), a.precision()
Expected:
(1.20000000000000, 't_REAL', 3)
Got:
(1.20000000000000, 't_REAL', 4)
**********************************************************************
1 items had failures:
1 of 18 in __main__.example_0036674092
sage -t -long -rand=1 devel/sage/sage/misc/randstate.pyx
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/misc/randstate.pyx", line 59:
: rtest()
Expected:
(207, 0.505364206568040, 4*x^2 + 1/2, (1,2)(4,5), [ 0, 0, 1, 0, 1 ],
2137873234, 27695, 0.19982565117278328)
Got:
(207, 0.505364206568040, 4*x^2 + 1/2, (2,3)(4,5), [ 0, 0, 1, 0, 1 ],
2137873234, 27695, 0.19982565117278328)
**********************************************************************
1 items had failures:
1 of 62 in __main__.example_0299976341
***Test Failed*** 1 failures.
The following might be related to
http://trac.sagemath.org/sage_trac/ticket/5789
sage -t -long -rand=1 devel/sage/sage/rings/real_rqdf.pyx
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/rings/real_rqdf.pyx", line 1116:
sage: RQDF(-1)._complex_double_(CDF)
Expected:
-1.0
Got:
doctest:1172: DeprecationWarning: RQDF is deprecated; use
RealField(212) instead.
-1.0
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/rings/real_rqdf.pyx", line 4:
: RQDF(1)
Expected:
doctest:...: DeprecationWarning: RQDF is deprecated; use
RealField(212) instead.
1.000000000000000000000000000000000000000000000000000000000000000
Got:
1.000000000000000000000000000000000000000000000000000000000000000
**********************************************************************
2 items had failures:
1 of 4 in __main__.example_0007003101
1 of 12 in __main__.example_0299976341
sage -t -long -rand=1 devel/sage/sage/libs/fplll/fplll.pyx
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/libs/fplll/fplll.pyx", line 715:
sage: A = gen_ntrulike(5,10,12); A
Expected:
[ 1 0 0 0 0 320 351 920 714 66]
[ 0 1 0 0 0 351 920 714 66 320]
[ 0 0 1 0 0 920 714 66 320 351]
[ 0 0 0 1 0 714 66 320 351 920]
[ 0 0 0 0 1 66 320 351 920 714]
[ 0 0 0 0 0 12 0 0 0 0]
[ 0 0 0 0 0 0 12 0 0 0]
[ 0 0 0 0 0 0 0 12 0 0]
[ 0 0 0 0 0 0 0 0 12 0]
[ 0 0 0 0 0 0 0 0 0 12]
Got:
[ 1 0 0 0 0 116 331 303 963 456]
[ 0 1 0 0 0 331 303 963 456 116]
[ 0 0 1 0 0 303 963 456 116 331]
[ 0 0 0 1 0 963 456 116 331 303]
[ 0 0 0 0 1 456 116 331 303 963]
[ 0 0 0 0 0 12 0 0 0 0]
[ 0 0 0 0 0 0 12 0 0 0]
[ 0 0 0 0 0 0 0 12 0 0]
[ 0 0 0 0 0 0 0 0 12 0]
[ 0 0 0 0 0 0 0 0 0 12]
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/libs/fplll/fplll.pyx", line 656:
sage: A = gen_uniform(10,10,12); A
[[tons more problems]]
age -t -long -rand=1
devel/sage/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx", line 379:
sage: f.small_roots()
Expected:
[4]
Got:
verbose 2 (<module>) epsilon = 0
verbose 2 (<module>) m = 3
verbose 2 (<module>) t = 0
verbose 2 (<module>) X = 4
verbose 1 (<module>) LLL of 9x12 matrix (algorithm fpLLL:wrapper)
verbose 1 (<module>) LLL finished (time = 0.0)
[4]
**********************************************************************
1 items had failures:
1 of 7 in __main__.example_0208607704
sage -t -long -rand=1
devel/sage/sage/rings/polynomial/polynomial_element.pyx
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/rings/polynomial/polynomial_element.pyx", line 3991:
sage: p.roots(ring=RR, algorithm='numpy')
Expected:
Traceback (most recent call last):
...
ValueError: array must not contain infs or NaNs
Got:
Traceback (most recent call last):
File "/scratch/wstein/build/sage-3.4.1.rc3/local/bin/ncadoctest.py",
line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File
"/scratch/wstein/build/sage-3.4.1.rc3/local/bin/sagedoctest.py", line 38,
in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename,
compileflags)
File "/scratch/wstein/build/sage-3.4.1.rc3/local/bin/ncadoctest.py",
line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_0061063177[118]>", line 1, in
<module>
p.roots(ring=RR, algorithm='numpy')###line 3991:
sage: p.roots(ring=RR, algorithm='numpy')
File "polynomial_element.pyx", line 4235, in
sage.rings.polynomial.polynomial_element.Polynomial.roots
(sage/rings/polynomial/polynomial_element.c:34787)
return self.change_ring(L).roots(multiplicities=multiplicities,
algorithm=algorithm)
File "polynomial_element.pyx", line 4156, in
sage.rings.polynomial.polynomial_element.Polynomial.roots
(sage/rings/polynomial/polynomial_element.c:33064)
raise
File "polynomial_element.pyx", line 4146, in
sage.rings.polynomial.polynomial_element.roots
(sage/rings/polynomial/polynomial_element.c:32862)
ext_rts1 = numpy.roots(numpy_array)
File "/home/wstein/build/sage-3.4.1.rc3/local/lib/python2.5/site-
packages/numpy/lib/polynomial.py", line 180, in roots
roots = _eigvals(A)
File "/home/wstein/build/sage-3.4.1.rc3/local/lib/python2.5/site-
packages/numpy/lib/polynomial.py", line 35, in _eigvals
return eigvals(arg)
File "/home/wstein/build/sage-3.4.1.rc3/local/lib/python2.5/site-
packages/numpy/linalg/linalg.py", line 597, in eigvals
_assertFinite(a)
File "/home/wstein/build/sage-3.4.1.rc3/local/lib/python2.5/site-
packages/numpy/linalg/linalg.py", line 125, in _assertFinite
raise LinAlgError, "Array must not contain infs or NaNs"
LinAlgError: Array must not contain infs or NaNs
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/rings/polynomial/polynomial_element.pyx", line 4002:
sage: p.roots(ring=RR)
Expected:
[(0.000000000000000, 1)]
Got:
[(-0.000000000000000, 1)]
sage -t -long -rand=1 devel/sage/sage/combinat/sloane_functions.py
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/combinat/sloane_functions.py", line 7203:
sage: initial = len(sloane.A001358._b)
Exception raised:
Traceback (most recent call last):
File "/scratch/wstein/build/sage-3.4.1.rc3/local/bin/ncadoctest.py",
line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File
"/scratch/wstein/build/sage-3.4.1.rc3/local/bin/sagedoctest.py", line 38,
in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename,
compileflags)
File "/scratch/wstein/build/sage-3.4.1.rc3/local/bin/ncadoctest.py",
line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_0246131326[2]>", line 1, in <module>
initial = len(sloane.A001358._b)###line 7203:
sage: initial = len(sloane.A001358._b)
AttributeError: 'A001358' object has no attribute '_b'
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/combinat/sloane_functions.py", line 7205:
sage: len(sloane.A001358._b) - initial > 0
Exception raised:
Traceback (most recent call last):
File "/scratch/wstein/build/sage-3.4.1.rc3/local/bin/ncadoctest.py",
line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File
"/scratch/wstein/build/sage-3.4.1.rc3/local/bin/sagedoctest.py", line 38,
in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename,
compileflags)
File "/scratch/wstein/build/sage-3.4.1.rc3/local/bin/ncadoctest.py",
line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_0246131326[4]>", line 1, in <module>
len(sloane.A001358._b) - initial > Integer(0)###line 7205:
sage: len(sloane.A001358._b) - initial > 0
NameError: name 'initial' is not defined
**********************************************************************
1 items had failures:
sage -t -long -rand=1 devel/sage/sage/combinat/words/word.py
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/combinat/words/word.py", line 119:
sage: w
Expected:
word: 2,1,3,12
Got:
word: 2-1-3-12
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/combinat/words/word.py", line 837:
sage: Words(range(1000))([0,1,10,101]).__str__()
Expected:
'word: 0,1,10,101'
Got:
'word: 0-1-10-101'
**********************************************************************
2 items had failures:
1 of 10 in __main__.example_1192818567
1 of 5 in __main__.example_1949818771
***Test Failed*** 2 failures.
sage -t -long -rand=1 devel/sage/sage/calculus/equations.py
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/calculus/equations.py", line 895:
sage: bool( x^2 > x )
Expected:
False
Got:
True
**********************************************************************
1 items had failures:
1 of 13 in __main__.example_3038663466
***Test Failed*** 1 failures.
sage -t -long -rand=1 devel/sage/sage/interfaces/r.py
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/interfaces/r.py", line 1071:
sage: t = a.trait_names()
Expected nothing
Got:
<BLANKLINE>
Building R command completion list (this takes
a few seconds only the first time you do it).
To force rebuild later, delete
/scratch/wstein/sage//r_commandlist.sobj.
**********************************************************************
1 items had failures:
1 of 5 in __main__.example_1346836858
sage -t -long -rand=1
devel/sage/sage/interfaces/singular.py**********************************************************************File
"/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/interfaces/singular.py", line 988: sage:
singular.trait_names()Expected: ['headStand', ...
'stdfglm']Got: ['pause', 'writelist', 'tab', 'split', 'showrecursive',
'show', 'rMacaulay', 'pmat', 'lprint', 'allprint', 'newtonDiag',
'subrInterred', 'id2mod', 'mod2id', 'denominator', 'numerator', 'content',
'lcm', 'rad_con', 'normalize', 'mindeg1', 'mindeg', 'maxdeg1', 'maxdeg',
'maxcoef', 'is_zero', 'freerank', 'kat_var', 'katsura', 'cyclic',
'substitute', 'hilbPoly', 'select1', 'select', 'sat', 'nselect', 'elim1',
'elim', 'blowup0', 'triangMH', 'triangM', 'triangLfak', 'triangL',
'absFactorize', 'newZero_decom
[[tons of other issues due to bad doctests]]
sage -t -long -rand=1 devel/sage/sage/interfaces/maxima.py
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/interfaces/maxima.py", line 1872:
sage: f.diff('x')
Expected:
34*y*'diff(y,x,1)+2*x
Got:
2*x
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/interfaces/maxima.py", line 1602:
sage: f = maxima('1/(x-1)^3'); f
Expected:
1/(x-1)^3
Got:
1
And *NUMEROUS* other issues!!
sage -t -long -rand=1 devel/sage/sage/combinat/partition.py
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/combinat/partition.py", line 2372:
sage: RestrictedPartitions(5,[3,2,1]).__repr__()
Expected:
doctest:...: DeprecationWarning: RestrictedPartitions is deprecated;
use Partitions with the parts_in keyword instead.
'Partitions of 5 restricted to the values [1, 2, 3] '
Got:
doctest:1: DeprecationWarning: RestrictedPartitions is deprecated; use
Partitions with the parts_in keyword instead.
doctest:2324: DeprecationWarning: RestrictedPartitions_nsk is
deprecated; use Partitions with the parts_in keyword instead.
'Partitions of 5 restricted to the values [1, 2, 3] '
[[and more]]
sage -t -long -rand=1 devel/sage/sage/calculus/calculus.py
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/calculus/calculus.py", line 8211:
sage: latex(factorial(x))
Exception raised:
Traceback (most recent call last):
File "/scratch/wstein/build/sage-3.4.1.rc3/local/bin/ncadoctest.py",
line 1231, in run_one_test
self.run_one_example(test, example, filename, compileflags)
File
"/scratch/wstein/build/sage-3.4.1.rc3/local/bin/sagedoctest.py", line 38,
in run_one_example
OrigDocTestRunner.run_one_example(self, test, example, filename,
compileflags)
File "/scratch/wstein/build/sage-3.4.1.rc3/local/bin/ncadoctest.py",
line 1172, in run_one_example
compileflags, 1) in test.globs
File "<doctest __main__.example_2333006911[2]>", line 1, in <module>
latex(factorial(x))###line 8211:
sage: latex(factorial(x))
File "/scratch/wstein/build/sage-3.4.1.rc3/local/lib/python2.5/site-
packages/sage/calculus/calculus.py", line 8249, in __call__
return factorial(n, **kwds)
File "/scratch/wstein/build/sage-3.4.1.rc3/local/lib/python2.5/site-
packages/sage/rings/arith.py", line 328, in factorial
raise ValueError, "factorial -- must be nonnegative"
ValueError: factorial -- must be nonnegative
(not much more)
sage -t -long -rand=1 devel/sage/sage/server/notebook/worksheet.py
**********************************************************************
File "/scratch/wstein/build/sage-3.4.1.rc3/devel/sage-
main/sage/server/notebook/worksheet.py", line 147:
sage: sage.server.notebook.worksheet._a_sage
Expected nothing
Got:
Sage
**********************************************************************
1 items had failures:
1 of 5 in __main__.example_3577862625
The following tests failed:
sage -t -long -rand=1 devel/sage/sage/modular/modform/space.py # 1
doctests failed
sage -t -long -rand=1 devel/sage/sage/misc/session.pyx # 1
doctests failed
sage -t -long -rand=1 devel/sage/sage/misc/latex.py # 17 doctests
failed
sage -t -long -rand=1 devel/sage/sage/libs/pari/gen.pyx # 1
doctests failed
sage -t -long -rand=1 devel/sage/sage/misc/randstate.pyx # 1
doctests failed
sage -t -long -rand=1 devel/sage/sage/rings/real_rqdf.pyx # 2
doctests failed
sage -t -long -rand=1 devel/sage/sage/libs/fplll/fplll.pyx # 5
doctests failed
sage -t -long -rand=1
devel/sage/sage/rings/polynomial/polynomial_modn_dense_ntl.pyx # 1
doctests failed
sage -t -long -rand=1
devel/sage/sage/rings/polynomial/polynomial_element.pyx # 2 doctests
failed
sage -t -long -rand=1 devel/sage/sage/combinat/sloane_functions.py
# 2 doctests failed
sage -t -long -rand=1 devel/sage/sage/combinat/words/word.py # 2
doctests failed
sage -t -long -rand=1 devel/sage/sage/calculus/equations.py # 1
doctests failed
sage -t -long -rand=1 devel/sage/sage/interfaces/r.py # 1 doctests
failed
sage -t -long -rand=1 devel/sage/sage/interfaces/singular.py # 6
doctests failed
sage -t -long -rand=1 devel/sage/sage/interfaces/maxima.py # 14
doctests failed
sage -t -long -rand=1 devel/sage/sage/combinat/partition.py # 2
doctests failed
sage -t -long -rand=1 devel/sage/sage/calculus/calculus.py # 5
doctests failed
sage -t -long -rand=1 devel/sage/sage/server/notebook/worksheet.py
# 1 doctests failed
----------------------------------------------------------------------
}}}
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5816#comment:2>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---