[Python-ideas] doctest

Mike Meyer mwm at mired.org
Fri Mar 2 19:27:54 CET 2012

Can I ask a possibly silly question?

As I understand it, doctest takes a small snippet of code, runs it,
and compares the resulting string with a string in the document.

This thread seems to be centered around making comparisons of results
with indeterminate ordering (dicts being the prime example) work
properly. In fact, one proposal was to have doctest call sorted on the
output to make sure it's right, which was shot down because that's not
always the correct thing to do.

So the question is - why isn't dealing with this the responsibility of
the test writer? Yeah, it's not quite the spirit of documentation to
turn a dictionary into a sorted list in the output, but neither is
littering the documentation with +LITERAL_EVAL and the like.

Mike Meyer <mwm at mired.org>		http://www.mired.org/
Independent Software developer/SCM consultant, email for more information.

O< ascii ribbon campaign - stop html mail - www.asciiribbon.org

More information about the Python-ideas mailing list