[TIP] Python Testing book review

Andrew Bennetts andrew at bemusement.org
Mon Mar 8 18:39:54 PST 2010


Olemis Lang wrote:
> On Sat, Mar 6, 2010 at 1:36 PM, Grig Gheorghiu <grig.gheorghiu at gmail.com> wrote:
> > I think you'll find broken code with typos in most technical books.
> 
> Unless the book itself relies on self-tested docs (and that's an
> important use case for all those people who lost their mind and use
> `doctest` ... even if some think they should say «help me, I have
> written a test suite using nothing but string matching assertions,
> what is wrong with me?!» ) . AFAICR that's how Hg book is written (and
> IMHO that was a great decision ;o)

FWIW, I'm the person you quote who said (tongue-in-cheek) “help me...”,
and I think automatically tested documentation is a wonderful idea.  I
think more people should do it, I think I should do more of it, and
thank you to everyone that has written tools that aim to make that task
easier.

This is an orthogonal concern to whether a good way to write precise and
maintainable assertions is by turning every single outcome to assert
into a string and then comparing it to another string.  I think that's a
terrible idea.  I think it can work well in some situations, but it's
not a tool to use to the exclusion of all others.

-Andrew.



More information about the testing-in-python mailing list