Show bytes ascii representation instead of numeric value
This commit is contained in:
@@ -331,17 +331,26 @@ class TestAssert_reprcompare:
|
||||
assert "- spam" in diff
|
||||
assert "+ eggs" in diff
|
||||
|
||||
def test_bytes_diff(self):
|
||||
def test_bytes_diff_normal(self):
|
||||
"""Check special handling for bytes diff (#5260)"""
|
||||
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"]
|
||||
|
||||
assert diff == [
|
||||
"b'spam' == b'eggs'",
|
||||
"At index 0 diff: b's' != b'e'",
|
||||
"Use -v to get the full diff",
|
||||
]
|
||||
|
||||
def test_bytes_diff_verbose(self):
|
||||
"""Check special handling for bytes diff (#5260)"""
|
||||
diff = callequal(b"spam", b"eggs", verbose=True)
|
||||
assert diff == [
|
||||
"b'spam' == b'eggs'",
|
||||
"At index 0 diff: b's' != b'e'",
|
||||
"Full diff:",
|
||||
"- b'spam'",
|
||||
"+ b'eggs'",
|
||||
]
|
||||
|
||||
def test_list(self):
|
||||
expl = callequal([0, 1], [0, 2])
|
||||
|
||||
Reference in New Issue
Block a user