Tim Peters <t...@python.org> added the comment:

Tomáš, of course you can combine testing methods any way you like.  Don't 
oversell this - there's nothing actually magical about comparing objects 
instead of strings ;-)

I'm only -0 on this.  It grates a bit against doctest's original intents, but I 
appreciate it could be quite useful at times.

About the lack of showing the values when "expr1 == expr2" is false, I don't 
care.  I can't recall any case where, e.g., assertEqual() showing both values 
was actually helpful.  To the contrary, it more often filled the screen with 
giant reprs that were worse than useless.  By its very nature, doctest 
comparing against an explicit string encourages tests with brief output.  When 
a test fails, no matter how it's reported non-trivial work to repair it usually 
follows.  By far the most important part is knowing _what_ failed.

"True matching 1" is a case of practicality beats purity:  a wart for sure, but 
standing out precisely because it's the only wart of its kind.  I doubt most 
users are even aware of it, and it's certainly not something most users need to 
know.

About different shells, it _is_ jarring to people at first that formatting 
differs among them.  But since the differences show up on every single line of 
input and output, the differences quickly stop diluting attention.

About how much of repr() output is defined, not really all that much.  The 
purpose of doctest was never to accept any conceivable implementation that met 
the letter of the reference manual, but to capture the output CPython actually 
produced.  That was intentional.  Over time, I count it as a Good Thing that 
"but what about doctests out there?" has acted as a pressure against gratuitous 
changes in repr() outputs, and nudged other implementations to make "who 
cares?" output decisions that matched CPython's.  Every silly difference incurs 
various costs, and doctest did aim to make the existence of those costs visible 
at once.  It's a fact of life that relatively few users read the reference 
manual, let alone understand it - and I don't hate them for that ;-)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32042>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to