diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2016-04-25 05:58:25 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2016-04-25 05:58:25 (GMT) |
commit | 685fbed7f9bbff7426aaef68581fddc64c4a71e3 (patch) | |
tree | 045f98f87994e95a4639e1867944ce455efba1d4 /Lib/unittest/case.py | |
parent | 5b6f0aa71c8f91a970eeb06eb8c636c8c69a569f (diff) | |
download | cpython-685fbed7f9bbff7426aaef68581fddc64c4a71e3.zip cpython-685fbed7f9bbff7426aaef68581fddc64c4a71e3.tar.gz cpython-685fbed7f9bbff7426aaef68581fddc64c4a71e3.tar.bz2 |
Issue #26837: assertSequenceEqual() now correctly outputs non-stringified
differing items (like bytes in the -b mode). This affects assertListEqual()
and assertTupleEqual().
Diffstat (limited to 'Lib/unittest/case.py')
-rw-r--r-- | Lib/unittest/case.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py index ac8d67d..524a7b1 100644 --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -964,7 +964,7 @@ class TestCase(object): if item1 != item2: differing += ('\nFirst differing element %d:\n%s\n%s\n' % - (i, item1, item2)) + ((i,) + _common_shorten_repr(item1, item2))) break else: if (len1 == len2 and seq_type is None and @@ -977,7 +977,7 @@ class TestCase(object): 'elements.\n' % (seq_type_name, len1 - len2)) try: differing += ('First extra element %d:\n%s\n' % - (len2, seq1[len2])) + (len2, safe_repr(seq1[len2]))) except (TypeError, IndexError, NotImplementedError): differing += ('Unable to index element %d ' 'of first %s\n' % (len2, seq_type_name)) @@ -986,7 +986,7 @@ class TestCase(object): 'elements.\n' % (seq_type_name, len2 - len1)) try: differing += ('First extra element %d:\n%s\n' % - (len1, seq2[len1])) + (len1, safe_repr(seq2[len1]))) except (TypeError, IndexError, NotImplementedError): differing += ('Unable to index element %d ' 'of second %s\n' % (len1, seq_type_name)) |