mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
#14649: clarify DocTestSuite error when there are no docstrings.
Also adds tests to verify the documented behavior (which is probably a bug, as indicated in the added comments). Patch by Chris Jerdonek.
This commit is contained in:
parent
7a8634d8d8
commit
8d580539f0
4 changed files with 57 additions and 6 deletions
|
@ -2381,7 +2381,12 @@ def DocTestSuite(module=None, globs=None, extraglobs=None, test_finder=None,
|
|||
elif not tests:
|
||||
# Why do we want to do this? Because it reveals a bug that might
|
||||
# otherwise be hidden.
|
||||
raise ValueError(module, "has no tests")
|
||||
# It is probably a bug that this exception is not also raised if the
|
||||
# number of doctest examples in tests is zero (i.e. if no doctest
|
||||
# examples were found). However, we should probably not be raising
|
||||
# an exception at all here, though it is too late to make this change
|
||||
# for a maintenance release. See also issue #14649.
|
||||
raise ValueError(module, "has no docstrings")
|
||||
|
||||
tests.sort()
|
||||
suite = unittest.TestSuite()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue