[issue18996] unittest: more helpful truncating long strings

Chris Withers report at bugs.python.org
Fri Jun 20 13:57:14 CEST 2014


Chris Withers added the comment:

So, this appears to be the source of some degraded behaviour for me with Python 3.4 versus Python 3.3.

This code, prior to 3.4:

from testfixtures import Comparison as C

class AClass:
    def __init__(self,x,y=None):
        self.x = x
        if y:
            self.y = y
    def __repr__(self):
        return '<'+self.__class__.__name__+'>'

...

self.assertEqual(
    C('testfixtures.tests.test_comparison.AClass',
      y=5, z='missing'),
      AClass(1, 2))

Would give the following output in the failure message:

"""
<C(failed):testfixtures.tests.test_comparison.AClass>
  x:1 not in Comparison
  y:5 != 2
  z:'missing' not in other
</C> != <AClass>"
"""

Now, in 3.4, you get the (rather unhelpful):

"""
<C(failed):testfixtures.tests.test_com[79 chars] </C> != <AClass>
"""

It's particularly disappointing that there's no API (class attribute, etc) to control whether or not this new behaviour is enabled.

What's the process I should tackle for getting this sorted out?

----------
nosy: +cjw296

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


More information about the Python-bugs-list mailing list