[TIP] doctest with nested dictionaries

Benji York benji at benjiyork.com
Thu Jul 5 05:13:10 PDT 2007


Graham Carlyle wrote:
> Another way of solving this would be to pformat the output to normalise
> it so:

That's what I'd probably do.

> and for other parts of the response that may be dynamic substitute
> placeholders...

Instead of using str.replace(), I'd either use ellipsis or, even better, 
  the regular expression normalizer so the dynamic parts of the test 
output are normalized automatically (the renormalizer is included in 
zope.testing, see 
http://svn.zope.org/zope.testing/trunk/src/zope/testing/renormalizing.py?view=markup).
-- 
Benji York
http://benjiyork.com



More information about the testing-in-python mailing list