Merge f083d5c50d
into dc65bb6a66
This commit is contained in:
commit
bcc967c739
2
AUTHORS
2
AUTHORS
|
@ -136,6 +136,7 @@ Eero Vaher
|
|||
Eli Boyarski
|
||||
Elizaveta Shashkova
|
||||
Éloi Rivard
|
||||
Emmeline Wetzel
|
||||
Endre Galaczi
|
||||
Eric Hunsberger
|
||||
Eric Liu
|
||||
|
@ -247,6 +248,7 @@ Loic Esteve
|
|||
Lukas Bednar
|
||||
Luke Murphy
|
||||
Maciek Fijalkowski
|
||||
Madeline Thai-Tang
|
||||
Maho
|
||||
Maik Figura
|
||||
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")
|
||||
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
|
||||
|
||||
|
||||
|
|
|
@ -282,6 +282,23 @@ TESTCASES = [
|
|||
""",
|
||||
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