[Tutor] assert() question

Kent Johnson kent37 at tds.net
Sun Jul 6 23:30:22 CEST 2008


On Sun, Jul 6, 2008 at 2:49 AM, Dick Moores <rdm at rcblue.com> wrote:
> I have a module, mycalc.py, which is a collection of functions designed to
> be imported independently.
>
> I've heard about using assert() to check up on whether things are still
> working correctly, or something like that. So I've begun to write some
> assert() expressions(?)  and put them at the bottom of the module.

You might be interested in the doctest module which lets you write
tests similar to these integrated with the doctstrings for your
functions.
http://docs.python.org/lib/module-doctest.html

Kent


More information about the Tutor mailing list