Escape whitespace only strings when diffing them on failed assertions
Fix #3443
This commit is contained in:
@@ -746,6 +746,18 @@ def test_reprcompare_notin(mock_config):
|
||||
assert detail == ["'foo' is contained here:", ' aaafoobbb', '? +++']
|
||||
|
||||
|
||||
def test_reprcompare_whitespaces(mock_config):
|
||||
detail = plugin.pytest_assertrepr_compare(
|
||||
mock_config, '==', '\r\n', '\n')
|
||||
assert detail == [
|
||||
r"'\r\n' == '\n'",
|
||||
r"Strings contain only whitespace, escaping them using repr()",
|
||||
r"- '\r\n'",
|
||||
r"? --",
|
||||
r"+ '\n'",
|
||||
]
|
||||
|
||||
|
||||
def test_pytest_assertrepr_compare_integration(testdir):
|
||||
testdir.makepyfile("""
|
||||
def test_hello():
|
||||
|
||||
Reference in New Issue
Block a user