doctest, unittest, or if __name__='__main__'

Christoph Zwerschke cito at
Tue Mar 21 23:47:08 CET 2006

john_sips_tea at schrieb:
> 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.").

I don't think doctest and unittest are similar ways; they are pretty 
different ways. Also, the "one obvious way" should not be overstressed 
and taken as a dogma for libraries, modules and frameworks. Actually, on 
that level we see the opposite in the Python world: A plethora of tools 
for XML processing, GUI frameworks, Web frameworks etc. Some think this 
is deplorable, but I see this as something exciting and positive.

-- Christoph

More information about the Python-list mailing list