Message168228
> 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. |
|
Date |
User |
Action |
Args |
2012-08-14 19:08:58 | chris.jerdonek | set | recipients:
+ chris.jerdonek, r.david.murray, asvetlov |
2012-08-14 19:08:58 | chris.jerdonek | set | messageid: <1344971338.4.0.339003436707.issue14649@psf.upfronthosting.co.za> |
2012-08-14 19:08:57 | chris.jerdonek | link | issue14649 messages |
2012-08-14 19:08:57 | chris.jerdonek | create | |
|