From 21c08dae13ffcdcbb16d9d4e371183efd70f8815 Mon Sep 17 00:00:00 2001 From: Kaylin Yeoh Date: Thu, 7 Dec 2023 19:57:53 -0500 Subject: [PATCH] added more tests to check for longer multiline string output and multiple multiline strings --- testing/test_assertion.py | 59 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/testing/test_assertion.py b/testing/test_assertion.py index 9ae04a9bf..b7f52026e 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -397,17 +397,29 @@ class TestAssert_reprcompare: ] def test_multiline_diff(self) -> None: - m = [ + m1 = [ "This is some dummy test which shows the strange way in which Pycharm" " displays the full diff." ] - assert callequal(m, []) == [ + m2 = [ + "This is some dummy test which shows the strange way in which Pycharm" + " displays the full diff.This is some dummy test which shows the strange way in which Pycharm" + " displays the full diff." + ] + m3 = [ + "This is some dummy test which shows the strange way in which Pycharm" + " displays the full diff.", + "This is some dummy test which shows the strange way in which Pycharm" + " displays the full diff." + ] + + assert callequal(m1, []) == [ "['This is som...e full diff.'] == []", "Left contains one more item: 'This is some dummy test which shows the " "strange way in which Pycharm displays the full diff.'", 'Use -v to get more diff', ] - assert callequal(m, [], verbose=True) == [ + assert callequal(m1, [], verbose=True) == [ "['This is som...e full diff.'] == []", "Left contains one more item: 'This is some dummy test which shows the " "strange way in which Pycharm displays the full diff.'", @@ -416,6 +428,47 @@ class TestAssert_reprcompare: "+ ['This is some dummy test which shows the strange way in which Pycharm " "displays the full diff.']", ] + + assert callequal(m2, []) == [ + "['This is som...e full diff.'] == []", + "Left contains one more item: 'This is some dummy test which shows the " + "strange way in which Pycharm displays the full diff.This is some dummy test " + "which shows the strange way in which Pycharm displays the full diff.'", + 'Use -v to get more diff', + ] + + assert callequal(m2, [], verbose=True) == [ + "['This is som...e full diff.'] == []", + "Left contains one more item: 'This is some dummy test which shows the " + "strange way in which Pycharm displays the full diff.This is some dummy test " + "which shows the strange way in which Pycharm displays the full diff.'", + "Full diff:", + "- []", + "+ ['This is some dummy test which shows the strange way in which Pycharm " + "displays the full diff.This is some dummy test which shows the strange " + "way in which Pycharm displays the full diff.']", + ] + + assert callequal(m3, []) == [ + "['This is som...e full diff.'] == []", + "Left contains 2 more items, first extra item: 'This is some dummy test which shows the strange way in " + "which Pycharm displays the full diff.'", + 'Use -v to get more diff', + ] + + assert callequal(m3, [], verbose=True) == [ + "['This is som...e full diff.'] == []", + "Left contains 2 more items, first extra item: 'This is some dummy test which shows the strange way in " + "which Pycharm displays the full diff.'", + "Full diff:", + " [", + "- ,", + "+ 'This is some dummy test which shows the strange way in which Pycharm " + "displays the full diff.',", + "+ 'This is some dummy test which shows the strange way in which Pycharm " + "displays the full diff.',", + " ]", + ] def test_text_skipping(self) -> None: lines = callequal("a" * 50 + "spam", "a" * 50 + "eggs")