Comment #8 on issue 1641 by smichr: doctests require newline only when run
for single file
http://code.google.com/p/sympy/issues/detail?id=1641
There is a difference (apparently) between python's doctest.testfile which
will
extract and run tests from the specified file and this other approach for
assembling
the tests:
tests = doctest.DocTestFinder().find(module)
for test in tests:
runner = doctest.DocTestRunner(optionflags=doctest.ELLIPSIS | \
doctest.NORMALIZE_WHITESPACE)
old = sys.stdout
new = StringIO()
sys.stdout = new
f, t = runner.run(test, out=new.write, clear_globs=False)
The latter approach is what is being used when docstrings in *.py files are
being
tested by sympy's doctest; the former is being used when the doc/src/*
files'
docstrings are being tested.
Note in comment 4 that I got different results because I was using two
different
methods of doing the tests: first, sympys doctest which uses the 'runner'
and then
the python doctest which uses doctest.testfile.
I don't get a difference in the interpreter or command line when I run the
tests (at
least with my modified runtests.py file) EXCEPT in the case of the doc/src
tests.
From the interpreter I get error; from the command line I get NO errors
==================================================
============ interpreter =========================
==================================================
>>> sympy.doctest('sympy/simplify')
============================= test process starts
==============================
executable: C:\Python26\Lib\site-packages\pythonwin\Pythonwin.exe
(2.6.2-final-0)
sympy\simplify\__init__.py[0]
[OK]
sympy\simplify\cse_main.py[0]
[OK]
sympy\simplify\cse_opts.py[1] .
[OK]
sympy\simplify\rewrite.py[1] .
[OK]
sympy\simplify\simplify.py[12] ............
[OK]
sympy\simplify\sqrtdenest.py[0]
[OK]
================== tests finished: 14 passed in 1.15 seconds
===================
True
>>> sympy.doctest('sympy/simplify/simplify.py')
============================= test process starts
==============================
executable: C:\Python26\Lib\site-packages\pythonwin\Pythonwin.exe
(2.6.2-final-0)
sympy\simplify\simplify.py[12] ............
[OK]
================== tests finished: 12 passed in 0.74 seconds
===================
True
>>> sympy.doctest()
============================= test process starts
==============================
executable: C:\Python26\Lib\site-packages\pythonwin\Pythonwin.exe
(2.6.2-final-0)
sympy\__init__.py[0]
[OK]
...
sympy\simplify\__init__.py[0]
[OK]
sympy\simplify\cse_main.py[0]
[OK]
sympy\simplify\cse_opts.py[1] .
[OK]
sympy\simplify\rewrite.py[1] .
[OK]
sympy\simplify\simplify.py[12] ............
[OK]
sympy\simplify\sqrtdenest.py[0]
[OK]
...
================= tests finished: 309 passed in 27.38 seconds
==================
Testing C:\Documents and Settings\chris\sympy\doc\src\aboutus.txt
Failed 0, tested 0
Testing C:\Documents and Settings\chris\sympy\doc\src\gotchas.txt
Failed 0, tested 101
Testing C:\Documents and Settings\chris\sympy\doc\src\guide.txt
Failed 0, tested 0
Testing C:\Documents and Settings\chris\sympy\doc\src\index.txt
Failed 0, tested 0
Testing C:\Documents and Settings\chris\sympy\doc\src\install.txt
Failed 0, tested 0
Testing C:\Documents and Settings\chris\sympy\doc\src\modules.txt
Failed 0, tested 0
Testing C:\Documents and Settings\chris\sympy\doc\src\outreach.txt
Failed 0, tested 0
Testing C:\Documents and
Settings\chris\sympy\doc\src\python-comparisons.txt
Failed 0, tested 0
Testing C:\Documents and
Settings\chris\sympy\doc\src\sympy-patches-tutorial.txt
Failed 0, tested 0
**********************************************************************
LOTS OF ERRORS IN TUTORIAL
...
DO *NOT* COMMIT!
False
==================================================
============ command line =========================
==================================================
same results for bin/doctest simplify, bin/doctest simplify/simplify.py but
no errors
for the tutorial.txt
Testing C:\Documents and Settings\chris\sympy\doc\src\tutorial.txt
Failed 0, tested 119
It might be useful if we came up with a little test suite for just the test
and
doctest testing files.
/c
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sympy-issues" 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/sympy-issues?hl=en
-~----------~----~----~----~------~----~------~--~---