[Tutor] testing: doctest and unittest

Colin J. Williams cjw at sympatico.ca
Tue Nov 8 16:16:17 CET 2005

Alex Hunsley wrote:

>Regards testing, I've been playing with both the unittest 
>(http://pyunit.sourceforge.net/pyunit.html) and doctest 
>(http://docs.python.org/lib/module-doctest.html). I was wondering what 
>peoples thoughts were on the effectiveness and convenience of one versus 
>the other. It seems to me that doctest is good for quicky and 
>straightforwards input/output tests for small units, whereas unittest 
>would be good for dynamic or complicated testing.
>Where do you seasoned pythonites see unittest and doctest in relation to 
>each other? Do you only use one or the other?
>Tutor maillist  -  Tutor at python.org
I looked at doctest and feel that it clutters the module text and so 
would prefer unittest but I haven't yet got to formalizing my tests in 
that way.

See some of the numarray source as an example of clutter.  Some argue 
that having the examples in the source is beneficial.  I agree but feel 
that the clutter outweighs the benefit.

Colin W.

Colin W.

More information about the Tutor mailing list