diff options
author | Raymond Hettinger <python@rcn.com> | 2003-07-16 19:25:22 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-07-16 19:25:22 (GMT) |
commit | 71adf7e9d8fb2aca563eeca806ea127409c82bb6 (patch) | |
tree | 6920d22bafb25a9b5bf685f05dcbc7cfbb02adcb /Doc/lib/libdoctest.tex | |
parent | 853276e16d6dfc214fcb88b53fe07fba21b58120 (diff) | |
download | cpython-71adf7e9d8fb2aca563eeca806ea127409c82bb6.zip cpython-71adf7e9d8fb2aca563eeca806ea127409c82bb6.tar.gz cpython-71adf7e9d8fb2aca563eeca806ea127409c82bb6.tar.bz2 |
Doctest now examines all docstrings by default. Previously, it would
skip over functions with private names (as indicated by the underscore
naming convention). The old default created too much of a risk that
user tests were being skipped inadvertently. Note, this change could
break code in the unlikely case that someone had intentionally put
failing tests in the docstrings of private functions. The breakage
is easily fixable by specifying the old behavior when calling testmod()
or Tester(). The more likely case is that the silent failure was
unintended and that the user needed to be informed so the test could be
fixed.
Diffstat (limited to 'Doc/lib/libdoctest.tex')
-rw-r--r-- | Doc/lib/libdoctest.tex | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Doc/lib/libdoctest.tex b/Doc/lib/libdoctest.tex index f213089..6bd6489 100644 --- a/Doc/lib/libdoctest.tex +++ b/Doc/lib/libdoctest.tex @@ -190,15 +190,16 @@ attempted. See \file{docstring.py} for all the details. They're unsurprising: the module docstring, and all function, class and method docstrings are -searched, with the exception of docstrings attached to objects with private -names. Objects imported into the module are not searched. +searched. Optionally, the tester can be directed to exclude +docstrings attached to objects with private names. +Objects imported into the module are not searched. In addition, if \code{M.__test__} exists and "is true", it must be a dict, and each entry maps a (string) name to a function object, class object, or string. Function and class object docstrings found from -\code{M.__test__} are searched even if the name is private, and -strings are searched directly as if they were docstrings. In output, -a key \code{K} in \code{M.__test__} appears with name +\code{M.__test__} are searched even if the the tester has been +directly to skip over private names in the rest of the module. +In output, a key \code{K} in \code{M.__test__} appears with name \begin{verbatim} <name of M>.__test__.K @@ -206,7 +207,7 @@ a key \code{K} in \code{M.__test__} appears with name Any classes found are recursively searched similarly, to test docstrings in their contained methods and nested classes. While private names reached -from \module{M}'s globals are skipped, all names reached from +from \module{M}'s globals can be optionally skipped, all names reached from \code{M.__test__} are searched. \subsection{What's the Execution Context?} |