test_assertion: harden/improve test_{text_diff,unicode} (#6806)

This commit is contained in:
Daniel Hahler 2020-02-24 15:19:08 +01:00 committed by GitHub
parent ac3a42bafd
commit 6a7df7f031
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 9 deletions

View File

@ -324,9 +324,11 @@ class TestAssert_reprcompare:
assert len(summary) < 65
def test_text_diff(self):
diff = callequal("spam", "eggs")[1:]
assert "- eggs" in diff
assert "+ spam" in diff
assert callequal("spam", "eggs") == [
"'spam' == 'eggs'",
"- eggs",
"+ spam",
]
def test_text_skipping(self):
lines = callequal("a" * 50 + "spam", "a" * 50 + "eggs")
@ -706,12 +708,11 @@ class TestAssert_reprcompare:
assert "raised in repr()" not in expl
def test_unicode(self):
left = "£€"
right = "£"
expl = callequal(left, right)
assert expl[0] == "'£€' == '£'"
assert expl[1] == "- £"
assert expl[2] == "+ £€"
assert callequal("£€", "£") == [
"'£€' == '£'",
"- £",
"+ £€",
]
def test_nonascii_text(self):
"""