Chris Jerdonek added the comment:

> Every doctest is docstring from tested module, but not every docstring is a 
> valid doctest.

Actually, I'm not sure even this is correct.  doctest will form a unittest 
*TestSuite* from a module if it has docstrings, but it will not necessarily 
create a test for each docstring.  You can see this by running code like the 
following on a target module that contains an empty docstring:

suite = doctest.DocTestSuite('doctest_target')
print(repr(suite))
print(suite.countTestCases())

which outputs--

<unittest.suite.TestSuite tests=[]>
0

So while "tests" (in the doctest code) evaluates to True (because it is a 
TestSuite instance), it still "has no tests."  If it wants to check for tests, 
it should probably be evaluating tests.countTestCases(), as David suggested.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14649>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to