doctest, unittest, or if __name__='__main__'

Fredrik Lundh fredrik at pythonware.com
Wed Mar 22 02:17:19 EST 2006


Terry Hancock wrote:

> Doctest is very easy to use, so it's easy to ensure that
> tests get written. OTOH, they're only really good for stuff
> that can be easily tested in the interpreter (e.g. that can
> be easily verified from their text output).  When you get
> into stickier stuff like graphics and web programming, the
> formal structure of pyunit can be easier to adapt than
> something which is intrinsically based on string processing.

that's puzzling.  I do lots of graphics, and some web programming (my
company's main product is a web application server for graphics), and
we use doctest for everything.

I find it a bit odd that someone thinks that there are tests for which

    assert something == somevalue

is easier to write than either

    >>> something
    somevalue

or

    >>> something == somevalue
    True

</F>






More information about the Python-list mailing list