[Python-ideas] doctest

Devin Jeanpierre jeanpierreda at gmail.com
Fri Mar 2 05:02:02 CET 2012

On Thu, Mar 1, 2012 at 10:51 PM, Ian Bicking <ianb at colorstudy.com> wrote:
> Personally I never copy from the interactive prompt, but instead write my
> doctest and, if I'm in the mood to copy and paste, copy from the failed
> doctest error message (which is nicely indented just like my tests).  So it
> would work fine if things were sorted.

I both copy from the interactive prompt and write myself by hand.
Either way, I don't want to care about order where order doesn't
matter. The less thought required to write a test or example, the
easier it is to write a test or example, and therefore the more
tests/examples people will write.

Why should we ever care about the order of a dict when writing an
example or test case?

> where attr is a dict or some other object with an awkward repr.  That's the
> part I'm unsure of.  Of course no eval will help you there either.  I don't
> know if there's any way to really replace repr's implementation everywhere;
> I'm guessing there isn't.

There isn't any (non-insane?) way to replace the repr that %r uses
(which is not builtins.repr).

-- Devin

More information about the Python-ideas mailing list