From 7c6915da640e6d8c59e1c627644447978b0e3d3e Mon Sep 17 00:00:00 2001 From: Kaylin Yeoh Date: Thu, 7 Dec 2023 18:56:03 -0500 Subject: [PATCH 1/2] added test cases for multiline string diffs --- testing/test_assertion.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/testing/test_assertion.py b/testing/test_assertion.py index 7c8c01556..9ae04a9bf 100644 --- a/testing/test_assertion.py +++ b/testing/test_assertion.py @@ -395,6 +395,27 @@ class TestAssert_reprcompare: "- eggs", "+ spam", ] + + def test_multiline_diff(self) -> None: + m = [ + "This is some dummy test which shows the strange way in which Pycharm" + " displays the full diff." + ] + assert callequal(m, []) == [ + "['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) == [ + "['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.'", + "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") From 7cab05fddadecf4608fd8478e52d4b30ec2e63e5 Mon Sep 17 00:00:00 2001 From: Kaylin Yeoh Date: Thu, 7 Dec 2023 19:03:42 -0500 Subject: [PATCH 2/2] added documentation --- AUTHORS | 2 ++ changelog/10863.bugfix.rst | 4 ++++ 2 files changed, 6 insertions(+) create mode 100644 changelog/10863.bugfix.rst diff --git a/AUTHORS b/AUTHORS index e30131d1a..731f3c92c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -180,6 +180,7 @@ Jake VanderPlas Jakob van Santen Jakub Mitoraj James Bourbeau +Jamie Chen Jan Balster Janne Vanhala Jason R. Coombs @@ -205,6 +206,7 @@ Justice Ndou Justyna Janczyszyn Kale Kundert Kamran Ahmad +Kaylin Yeoh Kenny Y Karl O. Pinc Karthikeyan Singaravelan diff --git a/changelog/10863.bugfix.rst b/changelog/10863.bugfix.rst new file mode 100644 index 000000000..60ac21559 --- /dev/null +++ b/changelog/10863.bugfix.rst @@ -0,0 +1,4 @@ +Found source causes multiline string diff error +Added private functions to check specific cases +Fixed output issue with implicit concatonated strings +Added tests in test assertion file in function test_multiline_diff