This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author chris.jerdonek
Recipients asvetlov, chris.jerdonek, r.david.murray
Date 2012-08-14.19:08:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1344971338.4.0.339003436707.issue14649@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2012-08-14 19:08:58chris.jerdoneksetrecipients: + chris.jerdonek, r.david.murray, asvetlov
2012-08-14 19:08:58chris.jerdoneksetmessageid: <1344971338.4.0.339003436707.issue14649@psf.upfronthosting.co.za>
2012-08-14 19:08:57chris.jerdoneklinkissue14649 messages
2012-08-14 19:08:57chris.jerdonekcreate