summaryrefslogtreecommitdiffstats
path: root/Lib/doctest.py
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-09-13 14:53:28 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-09-13 14:53:28 (GMT)
commit958cc890370d58b81bf15177f0dfeecff8714394 (patch)
tree22e287543bc1eafb3fb19006fc05fcccf63d4684 /Lib/doctest.py
parent302bd589ad22481795a8a34eceb66dabcfd6a2d6 (diff)
downloadcpython-958cc890370d58b81bf15177f0dfeecff8714394.zip
cpython-958cc890370d58b81bf15177f0dfeecff8714394.tar.gz
cpython-958cc890370d58b81bf15177f0dfeecff8714394.tar.bz2
exclude_empty: make the default True for DocTestFinder, and introduce it
with default False for testmod(). The real point of introducing this was so that output from doctest.master.summarize() would be the same as in 2.3, and doctest.master in 2.4 is a backward-compatability hack used only by testmod().
Diffstat (limited to 'Lib/doctest.py')
-rw-r--r--Lib/doctest.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py
index 156ef57..c1a87b3 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -848,8 +848,7 @@ class DocTestFinder:
"""
def __init__(self, verbose=False, parser=DocTestParser(),
- recurse=True, _namefilter=None,
- exclude_empty=False):
+ recurse=True, _namefilter=None, exclude_empty=True):
"""
Create a new doctest finder.
@@ -862,8 +861,8 @@ class DocTestFinder:
If the optional argument `recurse` is false, then `find` will
only examine the given object, and not any contained objects.
- If the optional argument `exclude_empty` is true, then `find`
- will exclude tests for objects with empty docstrings.
+ If the optional argument `exclude_empty` is false, then `find`
+ will include tests for objects with empty docstrings.
"""
self._parser = parser
self._verbose = verbose
@@ -1836,9 +1835,10 @@ master = None
def testmod(m=None, name=None, globs=None, verbose=None, isprivate=None,
report=True, optionflags=0, extraglobs=None,
- raise_on_error=False):
+ raise_on_error=False, exclude_empty=False):
"""m=None, name=None, globs=None, verbose=None, isprivate=None,
- report=True, optionflags=0, extraglobs=None
+ report=True, optionflags=0, extraglobs=None, raise_on_error=False,
+ exclude_empty=False
Test examples in docstrings in functions and classes reachable
from module m (or the current module if m is not supplied), starting
@@ -1930,7 +1930,7 @@ def testmod(m=None, name=None, globs=None, verbose=None, isprivate=None,
name = m.__name__
# Find, parse, and run all tests in the given module.
- finder = DocTestFinder(_namefilter=isprivate)
+ finder = DocTestFinder(_namefilter=isprivate, exclude_empty=exclude_empty)
if raise_on_error:
runner = DebugRunner(verbose=verbose, optionflags=optionflags)