doctest, unittest, or if __name__='__main__'

Fredrik Lundh fredrik at pythonware.com
Wed Mar 22 02:10:15 EST 2006


john_sips_tea at yahoo.com wrote:

> Well, since this is a mailing list where this sort of thing is
> discussed, and since I was was asking about which way
> is preferred, could you tell us why you (presumably) think
> doctest is vastly superior to unittest?

doctest comes with extensive documentation, which, among other
things, discuss the advantages of using doctest.  have you read the
documentation ?

    http://www.python.org/doc/lib/module-doctest.html

> > don't you have better things to do with your time ?
>
> That wasn't very friendly.

so you think that a "why all this creativity when you could just
standardize on something ported from java, and throw away every-
thing else" post is friendly ?  really ?

> Anyhow, I'm not attacking doctest, but rather, just trying
> to understand why there seems to be two very similar ways
> of testing your code built into the system (considering that
> one motto around here is "There should be one -- and
> preferably only one -- obvious way to do it.").

if you think that motto means that there should be only one non-
deprecated solution to any higher-level problem, you've completely
and utterly missed the point.

</F>






More information about the Python-list mailing list