Differences between revisions 6 and 7
Revision 6 as of 2007-05-21 23:45:04
Size: 878
Editor: CameronLaird
Comment:
Revision 7 as of 2008-11-15 14:00:00
Size: 884
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
 * [http://docs.python.org/lib/module-doctest.html doctest module] -- (python standard issue)  * [[http://docs.python.org/lib/module-doctest.html|doctest module]] -- (python standard issue)
Line 10: Line 10:
A [http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305292 nice example of doctest use] appears in A [[http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/305292|nice example of doctest use]] appears in
Line 14: Line 14:
"[http://www.onlamp.com/pub/a/python/2001/05/17/docstrings.html Python Documentation Tips and Tricks]". "[[http://www.onlamp.com/pub/a/python/2001/05/17/docstrings.html|Python Documentation Tips and Tricks]]".

doctest.py is a lightweight "literate programming"-style testing framework for python. Released by Tim Peters in 1999 now part of the python standard library.

You define a test by executing some code in an interactive session, and then pasting it along with the output into a nearby docstring. When you run your module at the command-line, doctest executes each one of these code examples, compares the expected and actual output and provides a report.

See also UnitTests

A nice example of doctest use appears in the PythonCookBook. Doctest also appears prominently in a 2001 one article titled "Python Documentation Tips and Tricks".

DocTest (last edited 2008-11-15 14:00:00 by localhost)

Unable to edit the page? See the FrontPage for instructions.