summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/case.py
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2010-12-24 11:20:30 (GMT)
committerRaymond Hettinger <python@rcn.com>2010-12-24 11:20:30 (GMT)
commit9d668dac6824f73f0edca15aa7b5f5ae7be5b5e2 (patch)
tree658fcff6ea44385250e86b2f5c188c950f45e517 /Lib/unittest/case.py
parentf954217458add5e23dff6996de9f022a8d9e3b54 (diff)
downloadcpython-9d668dac6824f73f0edca15aa7b5f5ae7be5b5e2.zip
cpython-9d668dac6824f73f0edca15aa7b5f5ae7be5b5e2.tar.gz
cpython-9d668dac6824f73f0edca15aa7b5f5ae7be5b5e2.tar.bz2
Put diff output in useful order (when the elements were first seen).
Diffstat (limited to 'Lib/unittest/case.py')
-rw-r--r--Lib/unittest/case.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py
index 235af82..82b139f 100644
--- a/Lib/unittest/case.py
+++ b/Lib/unittest/case.py
@@ -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)