[issue18996] unittest: more helpful truncating long strings

Serhiy Storchaka report at bugs.python.org
Mon Sep 16 21:17:18 CEST 2013


Serhiy Storchaka added the comment:

Indeed, I'll rename _common_shorten() to _common_shorten_repr() and call safe_repr() inside. As for two vs multiple args, first I wrote a variant with two args (you can see it in my first unlinked patch), but then I seen that general variant is not harder and even shorter.

I'm open for bikeshedding. Perhaps we should change the placeholder to something better (e.g. to "[... skipped ...]")? Is the number of skipped characters is useful? Note that it is a number of skipped characters in the repr, not in the original strings and can be misguided for strings. Perhaps we should change minimal lengths of head, tail, and interior part? Why part is most important and should be larger? Perhaps add a keyword-only parameter maxlen (or other parameters for customization)?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18996>
_______________________________________


More information about the Python-bugs-list mailing list