Fix/improve comparison of byte strings
Fixes https://github.com/pytest-dev/pytest/issues/5260.
This commit is contained in:
committed by
Bruno Oliveira
parent
64a6365227
commit
8c7eb82363
@@ -331,6 +331,18 @@ class TestAssert_reprcompare:
|
||||
assert "- spam" in diff
|
||||
assert "+ eggs" in diff
|
||||
|
||||
def test_bytes_diff(self):
|
||||
diff = callequal(b"spam", b"eggs")
|
||||
if PY3:
|
||||
assert diff == [
|
||||
"b'spam' == b'eggs'",
|
||||
"At index 0 diff: 115 != 101",
|
||||
"Use -v to get the full diff",
|
||||
]
|
||||
else:
|
||||
# Handled as text on Python 2.
|
||||
assert diff == ["'spam' == 'eggs'", "- spam", "+ eggs"]
|
||||
|
||||
def test_list(self):
|
||||
expl = callequal([0, 1], [0, 2])
|
||||
assert len(expl) > 1
|
||||
|
||||
Reference in New Issue
Block a user