Your search query "linkto%3A%22DocTest%22" didn't return any results. Please change some terms and refer to HelpOnSearching for more information.
(!) Consider performing a full-text search with your search terms.

Clear message

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".

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