mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Put diff output in useful order (when the elements were first seen).
This commit is contained in:
parent
f954217458
commit
9d668dac68
2 changed files with 13 additions and 11 deletions
|
@ -1023,18 +1023,15 @@ class TestCase(object):
|
|||
expected = collections.Counter(expected_seq)
|
||||
except TypeError:
|
||||
# Handle case with unhashable elements
|
||||
differences = _count_diff_all_purpose(expected_seq, actual_seq)
|
||||
differences = _count_diff_all_purpose(actual_seq, expected_seq)
|
||||
else:
|
||||
if actual == expected:
|
||||
return
|
||||
differences = _count_diff_hashable(expected_seq, actual_seq)
|
||||
differences = _count_diff_hashable(actual_seq, expected_seq)
|
||||
|
||||
if differences:
|
||||
standardMsg = 'Element counts were not equal:\n'
|
||||
lines = []
|
||||
for act, exp, elem in differences:
|
||||
line = 'Expected %d, got %d: %r' % (exp, act, elem)
|
||||
lines.append(line)
|
||||
lines = ['Got %d, expected %d: %r' % diff for diff in differences]
|
||||
diffMsg = '\n'.join(lines)
|
||||
standardMsg = self._truncateMessage(standardMsg, diffMsg)
|
||||
msg = self._formatMessage(msg, standardMsg)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue