Merge f083d5c50d
into dc65bb6a66
This commit is contained in:
commit
bcc967c739
2
AUTHORS
2
AUTHORS
|
@ -136,6 +136,7 @@ Eero Vaher
|
||||||
Eli Boyarski
|
Eli Boyarski
|
||||||
Elizaveta Shashkova
|
Elizaveta Shashkova
|
||||||
Éloi Rivard
|
Éloi Rivard
|
||||||
|
Emmeline Wetzel
|
||||||
Endre Galaczi
|
Endre Galaczi
|
||||||
Eric Hunsberger
|
Eric Hunsberger
|
||||||
Eric Liu
|
Eric Liu
|
||||||
|
@ -247,6 +248,7 @@ Loic Esteve
|
||||||
Lukas Bednar
|
Lukas Bednar
|
||||||
Luke Murphy
|
Luke Murphy
|
||||||
Maciek Fijalkowski
|
Maciek Fijalkowski
|
||||||
|
Madeline Thai-Tang
|
||||||
Maho
|
Maho
|
||||||
Maik Figura
|
Maik Figura
|
||||||
Mandeep Bhutani
|
Mandeep Bhutani
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Changed the diff explanation for string comparison assertions when there is a tab in the string to show ``\t`` instead of four spaces.
|
|
@ -319,6 +319,10 @@ def _diff_text(left: str, right: str, verbose: int = 0) -> List[str]:
|
||||||
line.strip("\n")
|
line.strip("\n")
|
||||||
for line in ndiff(right.splitlines(keepends), left.splitlines(keepends))
|
for line in ndiff(right.splitlines(keepends), left.splitlines(keepends))
|
||||||
]
|
]
|
||||||
|
for i in range(len(explanation)):
|
||||||
|
if "? " not in explanation[i]: # dont replace diff message tab
|
||||||
|
explanation[i] = explanation[i].replace("+ ", "+ \\t")
|
||||||
|
explanation[i] = explanation[i].replace(" ", "\\t")
|
||||||
return explanation
|
return explanation
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -282,6 +282,23 @@ TESTCASES = [
|
||||||
""",
|
""",
|
||||||
id="Compare attrs classes",
|
id="Compare attrs classes",
|
||||||
),
|
),
|
||||||
|
pytest.param(
|
||||||
|
"""
|
||||||
|
def test_this():
|
||||||
|
result = '''spam bacon
|
||||||
|
eggs love'''
|
||||||
|
desired = "spam bacon eggs love"
|
||||||
|
assert result == desired
|
||||||
|
""",
|
||||||
|
"""
|
||||||
|
> assert result == desired
|
||||||
|
E AssertionError: assert 'spam bacon\\n eggs love' == 'spam bacon eggs love'
|
||||||
|
E - spam bacon eggs love
|
||||||
|
E + spam\\tbacon
|
||||||
|
E + \\teggs love
|
||||||
|
""",
|
||||||
|
id="Test tab repr in diff",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue