Skip to content

Commit 6a7df7f

Browse files
authored
test_assertion: harden/improve test_{text_diff,unicode} (#6806)
1 parent ac3a42b commit 6a7df7f

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

testing/test_assertion.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,11 @@ def test_summary(self):
324324
assert len(summary) < 65
325325

326326
def test_text_diff(self):
327-
diff = callequal("spam", "eggs")[1:]
328-
assert "- eggs" in diff
329-
assert "+ spam" in diff
327+
assert callequal("spam", "eggs") == [
328+
"'spam' == 'eggs'",
329+
"- eggs",
330+
"+ spam",
331+
]
330332

331333
def test_text_skipping(self):
332334
lines = callequal("a" * 50 + "spam", "a" * 50 + "eggs")
@@ -706,12 +708,11 @@ def test_repr_no_exc(self):
706708
assert "raised in repr()" not in expl
707709

708710
def test_unicode(self):
709-
left = "£€"
710-
right = "£"
711-
expl = callequal(left, right)
712-
assert expl[0] == "'£€' == '£'"
713-
assert expl[1] == "- £"
714-
assert expl[2] == "+ £€"
711+
assert callequal("£€", "£") == [
712+
"'£€' == '£'",
713+
"- £",
714+
"+ £€",
715+
]
715716

716717
def test_nonascii_text(self):
717718
"""

0 commit comments

Comments
 (0)