[Python-ideas] doctest

Barry Warsaw barry at python.org
Tue Feb 28 23:14:14 CET 2012


On Feb 27, 2012, at 08:35 PM, Michael Foord wrote:

>The problem of being dependent on order of unorderable types (actually very
>difficult to solve).

Actually, not so much, only because IME, I find that I rarely want to just
dump the repr of such objects.  That's usually going to be hard to read even
if the output were sorted.  Instead, I very often iterate over the items (in
sorted order of course), and use ellipses to ignore the lines (i.e. items) I
don't care about.  In practice, I haven't found this one to be so bad.

>Things like shared fixtures and mocking become *harder* (although by no
>means impossible) in a doctest environment.

Not if you use separate DocFileSuites.

>Another thing I dislike is that it encourages a "test last" approach, as by
>far the easiest way of generating doctests is to copy and paste from the
>interactive interpreter. The alternative is lots of annoying typing of
>'>>>' and '...', and as you're editing text and not code IDE support tends
>to be worse (although this is a tooling issue and not a problem with
>doctest itself).

Actually, Emacs users should use rst-mode, which has no so bad support for
separate file doctests.  Of course, the mode is useful for reST documentation
even if your documentation is untested <wink>.

-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20120228/3d3a5692/attachment.pgp>


More information about the Python-ideas mailing list