| Issue 80: | failing doctests | |
| 1 person starred this issue and may be notified of changes. | Back to list |
$ python run_doctest.py
summation.txt
Traceback (most recent call last):
File "run_doctest.py", line 12, in <module>
doctest.testfile(os.path.join(path, f), module_relative=False)
File "/usr/lib/python2.5/doctest.py", line 1937, in testfile
test = parser.get_doctest(text, globs, name, filename, 0)
File "/usr/lib/python2.5/doctest.py", line 594, in get_doctest
return DocTest(self.get_examples(string, name), globs,
File "/usr/lib/python2.5/doctest.py", line 608, in get_examples
return [x for x in self.parse(string, name)
File "/usr/lib/python2.5/doctest.py", line 570, in parse
self._parse_example(m, name, lineno)
File "/usr/lib/python2.5/doctest.py", line 640, in _parse_example
lineno + len(source_lines))
File "/usr/lib/python2.5/doctest.py", line 726, in _check_prefix
(lineno+i+1, name, line))
ValueError: line 10 of the docstring for summation.txt has inconsistent
leading whitespace: '\r'
|
|
,
Oct 10, 2008
I don't get that error, but several doctests fail expectedly since the docs haven't been updated. Could your problem be a Unix/Windows issue? |
|
,
Nov 17, 2008
A lot of mpmath doctests are failing in sympy currently. I think they need to be fixed, can you acknowledge? |
|
,
Nov 18, 2008
Which ones? Possibly at least some of them have been fixed in mpmath. Right now there are (passing) docstring doctests in calculus.py, functions.py, elliptic.py and identification.py that can be run by invoking the .py files. There should just be a way to run them all automatically. |
|
,
Nov 18, 2008
Ondrej implemented a very nice doctest runner. Using it for sympy I figured out that
many doctests fail (because they were outdated -- some of them were never tested,
fundamental imports were missing). I fixed them, except for mpmath, because this
should be fixed here and I wanted to know your opinion.
There are quite a lot of tests failing:
File "/home/one/src/sympy/git/sympy/mpmath/calculus.py", line 244, in
sympy.mpmath.calculus.polyroots
Failed example:
nprint(polyroots([4,3,2], error=True))
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.calculus.polyroots[1]>", line 1, in <module>
nprint(polyroots([4,3,2], error=True))
NameError: name 'nprint' is not defined
________________________________________________________________________________
_____________________ sympy.mpmath.identification.identify _____________________
File "/home/one/src/sympy/git/sympy/mpmath/identification.py", line 289, in
sympy.mpmath.identification.identify
Failed example:
identify(3*pi + 4*sqrt(2), ['pi','sqrt(2)'])
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.identification.identify[3]>", line 1, in <module>
identify(3*pi + 4*sqrt(2), ['pi','sqrt(2)'])
NameError: name 'pi' is not defined
________________________________________________________________________________
__________________________ sympy.mpmath.mptypes.nstr ___________________________
File "/home/one/src/sympy/git/sympy/mpmath/mptypes.py", line 827, in
sympy.mpmath.mptypes.nstr
Failed example:
nstr([+pi, ldexp(1,-500)])
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.mptypes.nstr[0]>", line 1, in <module>
nstr([+pi, ldexp(1,-500)])
NameError: name 'pi' is not defined
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/mptypes.py", line 829, in
sympy.mpmath.mptypes.nstr
Failed example:
print([+pi, ldexp(1,-500)])
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.mptypes.nstr[1]>", line 1, in <module>
print([+pi, ldexp(1,-500)])
NameError: name 'pi' is not defined
________________________________________________________________________________
_________________________ sympy.mpmath.quadrature.quad _________________________
File "/home/one/src/sympy/git/sympy/mpmath/quadrature.py", line 342, in
sympy.mpmath.quadrature.quad
Failed example:
from mpmath import *
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.quadrature.quad[0]>", line 1, in <module>
from mpmath import *
ImportError: No module named mpmath
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/quadrature.py", line 346, in
sympy.mpmath.quadrature.quad
Failed example:
print quad(f, [0, 1], [0, pi])
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.quadrature.quad[3]>", line 1, in <module>
print quad(f, [0, 1], [0, pi])
File "sympy/mpmath/quadrature.py", line 390, in quad
points[0], prec, epsilon, m, verbose)
File "sympy/mpmath/quadrature.py", line 129, in summation
results.append(cls.sum_next(prec, level, results, g, verbose))
File "sympy/mpmath/quadrature.py", line 188, in sum_next
S += w*(f(NEG(x)) + f(x))
File "sympy/mpmath/quadrature.py", line 56, in g
return C * f(D + C*x)
File "sympy/mpmath/quadrature.py", line 389, in <lambda>
points[1], prec, epsilon, m)[0],
File "sympy/mpmath/quadrature.py", line 129, in summation
results.append(cls.sum_next(prec, level, results, g, verbose))
File "sympy/mpmath/quadrature.py", line 188, in sum_next
S += w*(f(NEG(x)) + f(x))
File "sympy/mpmath/quadrature.py", line 56, in g
return C * f(D + C*x)
File "sympy/mpmath/quadrature.py", line 388, in <lambda>
rule.summation(lambda y: f(x,y), \
File "<doctest sympy.mpmath.quadrature.quad[2]>", line 1, in <lambda>
f = lambda x, y: exp(x*sin(y))
NameError: global name 'sin' is not defined
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/quadrature.py", line 358, in
sympy.mpmath.quadrature.quad
Failed example:
print quadgl(lambda x: abs(sin(x)), [0, pi, 2*pi])
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.quadrature.quad[4]>", line 1, in <module>
print quadgl(lambda x: abs(sin(x)), [0, pi, 2*pi])
File "sympy/mpmath/quadrature.py", line 452, in quadgl
return quad(*args, **kwargs)
File "sympy/mpmath/quadrature.py", line 385, in quad
v, err = rule.summation(f, points[0], prec, epsilon, m, verbose)
File "sympy/mpmath/quadrature.py", line 129, in summation
results.append(cls.sum_next(prec, level, results, g, verbose))
File "sympy/mpmath/quadrature.py", line 326, in sum_next
s += w * (f(NEG(x)) + f(x))
File "sympy/mpmath/quadrature.py", line 56, in g
return C * f(D + C*x)
File "<doctest sympy.mpmath.quadrature.quad[4]>", line 1, in <lambda>
print quadgl(lambda x: abs(sin(x)), [0, pi, 2*pi])
NameError: global name 'sin' is not defined
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/quadrature.py", line 360, in
sympy.mpmath.quadrature.quad
Failed example:
print quadgl(sin, arange(0, 1000+1, 10))
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.quadrature.quad[5]>", line 1, in <module>
print quadgl(sin, arange(0, 1000+1, 10))
NameError: name 'sin' is not defined
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/quadrature.py", line 362, in
sympy.mpmath.quadrature.quad
Failed example:
print cos(0) - cos(1000)
Exception raised:
Traceback (most recent call last):
File "/usr/lib/python2.5/doctest.py", line 1228, in __run
compileflags, 1) in test.globs
File "<doctest sympy.mpmath.quadrature.quad[6]>", line 1, in <module>
print cos(0) - cos(1000)
NameError: name 'cos' is not defined
________________________________________________________________________________
___________ sympy.mpmath.tests.test_power.test_pow_epsilon_rounding ____________
File "/home/one/src/sympy/git/sympy/mpmath/tests/test_power.py", line 40, in
sympy.mpmath.tests.test_power.test_pow_epsilon_rounding
Failed example:
1.0001 ** -5
Expected:
0.99950014996500702
Got:
0.999500149965
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/tests/test_power.py", line 42, in
sympy.mpmath.tests.test_power.test_pow_epsilon_rounding
Failed example:
0.9999 ** -5
Expected:
1.000500150035007
Got:
1.00050015004
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/tests/test_power.py", line 44, in
sympy.mpmath.tests.test_power.test_pow_epsilon_rounding
Failed example:
(-1.0001) ** -5
Expected:
-0.99950014996500702
Got:
-0.999500149965
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/tests/test_power.py", line 46, in
sympy.mpmath.tests.test_power.test_pow_epsilon_rounding
Failed example:
(-0.9999) ** -5
Expected:
-1.000500150035007
Got:
-1.00050015004
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/tests/test_power.py", line 49, in
sympy.mpmath.tests.test_power.test_pow_epsilon_rounding
Failed example:
1.0001 ** -6
Expected:
0.99940020994401269
Got:
0.999400209944
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/tests/test_power.py", line 51, in
sympy.mpmath.tests.test_power.test_pow_epsilon_rounding
Failed example:
0.9999 ** -6
Expected:
1.0006002100560125
Got:
1.00060021006
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/tests/test_power.py", line 53, in
sympy.mpmath.tests.test_power.test_pow_epsilon_rounding
Failed example:
(-1.0001) ** -6
Expected:
0.99940020994401269
Got:
0.999400209944
**********************************************************************
File "/home/one/src/sympy/git/sympy/mpmath/tests/test_power.py", line 55, in
sympy.mpmath.tests.test_power.test_pow_epsilon_rounding
Failed example:
(-0.9999) ** -6
Expected:
1.0006002100560125
Got:
1.00060021006
________________________________________________________________________________
|
|
,
Nov 18, 2008
I think most of those tests are outdated. Anyway, I'll make sure all doctests work as I'm revising the documentation per issue 92 (I just haven't gotten everywhere yet). The last ones are interesting. 1.0001**-5 does repr to 0.99950014996500702 for me, on at least three different systems; why doesn't it for you? |
|
,
Nov 18, 2008
Python 2.5.2 (r252:60911, Aug 1 2008, 00:43:38) [GCC 4.3.1 20080507 (prerelease) [gcc-4_3-branch revision 135036]] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> 1.0001**-5 0.99950014996500702 Maybe a bug in Ondrej's doctest runner (it's not yet finished nor committed). I'll wait until you revised the documentation before trying to fix it in sympy. Please let me know if I can help you! |
|
|
|