summaryrefslogtreecommitdiffstats
path: root/Doc/library/doctest.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/doctest.rst')
-rw-r--r--Doc/library/doctest.rst12
1 files changed, 11 insertions, 1 deletions
diff --git a/Doc/library/doctest.rst b/Doc/library/doctest.rst
index cdd6c26..ed53f06 100644
--- a/Doc/library/doctest.rst
+++ b/Doc/library/doctest.rst
@@ -338,7 +338,7 @@ The fine print:
Backslashes in a raw docstring: m\n
Otherwise, the backslash will be interpreted as part of the string. For example,
- the "\\" above would be interpreted as a newline character. Alternatively, you
+ the ``\n`` above would be interpreted as a newline character. Alternatively, you
can double each backslash in the doctest version (and not use a raw string)::
>>> def f(x):
@@ -1024,6 +1024,16 @@ from text files and modules with doctests:
This function uses the same search technique as :func:`testmod`.
+ .. note::
+ Unlike :func:`testmod` and :class:`DocTestFinder`, this function raises
+ a :exc:`ValueError` if *module* contains no docstrings. You can prevent
+ this error by passing a :class:`DocTestFinder` instance as the
+ *test_finder* argument with its *exclude_empty* keyword argument set
+ to ``False``::
+
+ >>> finder = doctest.DocTestFinder(exclude_empty=False)
+ >>> suite = doctest.DocTestSuite(test_finder=finder)
+
Under the covers, :func:`DocTestSuite` creates a :class:`unittest.TestSuite` out
of :class:`doctest.DocTestCase` instances, and :class:`DocTestCase` is a