mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Patch #486438: Make module argument to testmod optional.
This commit is contained in:
parent
f86e8ef33e
commit
4581cfa326
3 changed files with 20 additions and 5 deletions
|
@ -152,6 +152,10 @@ if __name__ == "__main__":
|
|||
_test()
|
||||
\end{verbatim}
|
||||
|
||||
If you want to test the module as the main module, you don't need to
|
||||
pass M to \function{testmod}; in this case, it will test the current
|
||||
module.
|
||||
|
||||
Then running the module as a script causes the examples in the docstrings
|
||||
to get executed and verified:
|
||||
|
||||
|
@ -392,7 +396,7 @@ definition of \function{_test()} is
|
|||
\begin{verbatim}
|
||||
def _test():
|
||||
import doctest, sys
|
||||
doctest.testmod(sys.modules["__main__"])
|
||||
doctest.testmod()
|
||||
\end{verbatim}
|
||||
\end{enumerate}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue