Software: Apache/2.0.54 (Unix) mod_perl/1.99_09 Perl/v5.8.0 mod_ssl/2.0.54 OpenSSL/0.9.7l DAV/2 FrontPage/5.0.2.2635 PHP/4.4.0 mod_gzip/2.0.26.1a uname -a: Linux snow.he.net 4.4.276-v2-mono-1 #1 SMP Wed Jul 21 11:21:17 PDT 2021 i686 uid=99(nobody) gid=98(nobody) groups=98(nobody) Safe-mode: OFF (not secure) /opt/doc/python-2.3.4/html/Python-Docs-2.3.4/lib/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 5.2.1 Normal UsageIn normal use, end each module M with:
def _test():
import doctest, M # replace M with your module's name
return doctest.testmod(M) # ditto
if __name__ == "__main__":
_test()
If you want to test the module as the main module, you don't need to pass M to 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:
python M.py
This won't display anything unless an example fails, in which case the
failing example(s) and the cause(s) of the failure(s) are printed to stdout,
and the final line of output is Run it with the -v switch instead:
python M.py -v and a detailed report of all examples tried is printed to standard output, along with assorted summaries at the end.
You can force verbose mode by passing
In any case, testmod() returns a 2-tuple of ints See About this document... for information on suggesting changes. |
:: Command execute :: | |
--[ c99shell v. 1.0 pre-release build #13 powered by Captain Crunch Security Team | http://ccteam.ru | Generation time: 0.0045 ]-- |