summaryrefslogtreecommitdiff
path: root/testing/test_assertion.py
diff options
context:
space:
mode:
authorDaniel Hahler <git@thequod.de>2020-02-24 15:19:08 +0100
committerGitHub <noreply@github.com>2020-02-24 15:19:08 +0100
commit6a7df7f03165a3b802be07c835286dbcb6acc351 (patch)
tree051af9b61fcb63b6f8cf550cc633011878b4d096 /testing/test_assertion.py
parentac3a42bafdbff0de63ff75f89119594f18767dc2 (diff)
downloadpytest-6a7df7f03165a3b802be07c835286dbcb6acc351.tar.gz
test_assertion: harden/improve test_{text_diff,unicode} (#6806)
Diffstat (limited to 'testing/test_assertion.py')
-rw-r--r--testing/test_assertion.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/testing/test_assertion.py b/testing/test_assertion.py
index 453bb2fc7..b12b3b119 100644
--- a/testing/test_assertion.py
+++ b/testing/test_assertion.py
@@ -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):
"""