doctest, unittest, or if __name__='__main__'

Fredrik Lundh fredrik at pythonware.com
Wed Mar 22 08:21:17 CET 2006


Tim Peters wrote:

> Equally true of #1, if you write doctest files separate from your
> code.

newer versions of doctest have more extensive support for this, but the old
trick of using doctest to test your *test programs* work remarkably well.

> In fact, it's standard practice there to write "tutorial doctest" files for a
> new feature before writing code to implement it.

another good practice is to add regression doctests for each verified bug,
*before* attempting to fix it.

</F>






More information about the Python-list mailing list