Fix bug when the right list was longer then the left
Thanks to Holger for finding this. --HG-- branch : trunk
This commit is contained in:
parent
56b955dfb5
commit
c3166ee84a
|
@ -89,7 +89,7 @@ def _compare_eq_sequence(left, right):
|
||||||
'first extra item: %s' % left[len(right)]]
|
'first extra item: %s' % left[len(right)]]
|
||||||
elif len(left) < len(right):
|
elif len(left) < len(right):
|
||||||
explanation += ['Right contains more items, '
|
explanation += ['Right contains more items, '
|
||||||
'first extra item: %s' % right[len(right)]]
|
'first extra item: %s' % right[len(left)]]
|
||||||
return explanation + _pprint_diff(left, right)
|
return explanation + _pprint_diff(left, right)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,12 @@ class TestAssertCompare:
|
||||||
expl = plugin.pytest_assert_binrepr('==', [0, 1], [0, 2])
|
expl = plugin.pytest_assert_binrepr('==', [0, 1], [0, 2])
|
||||||
assert len(expl) > 1
|
assert len(expl) > 1
|
||||||
|
|
||||||
|
def test_list_different_lenghts(self):
|
||||||
|
expl = plugin.pytest_assert_binrepr('==', [0, 1], [0, 1, 2])
|
||||||
|
assert len(expl) > 1
|
||||||
|
expl = plugin.pytest_assert_binrepr('==', [0, 1, 2], [0, 1])
|
||||||
|
assert len(expl) > 1
|
||||||
|
|
||||||
def test_dict(self):
|
def test_dict(self):
|
||||||
expl = plugin.pytest_assert_binrepr('==', {'a': 0}, {'a': 1})
|
expl = plugin.pytest_assert_binrepr('==', {'a': 0}, {'a': 1})
|
||||||
assert len(expl) > 1
|
assert len(expl) > 1
|
||||||
|
|
Loading…
Reference in New Issue