doctest — Testing Through Documentation — PyMOTW 3

doctest tests source code by running examples embedded in the documentation and verifying that they produce the expected results. It works by parsing the help text to find examples, running them, then comparing the output text against the expected value. Many developers find doctest easier to use than unittest because, in its simplest form, there is no API to learn before using it. However, as the examples become more complex the lack of fixture management can make writing doctest tests more cumbersome than using unittest .

Read more…

This post is part of the Python Module of the Week series for Python 3. See for more articles from the series.