From 60e49ae40c6a289b2a6f9b9a6f72fcebca7142db Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Tue, 18 Jul 2023 15:13:14 -0300 Subject: [PATCH] added test_replace_part_with_missing_varied_leading_whitespace --- tests/test_editblock.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tests/test_editblock.py b/tests/test_editblock.py index bd5dc6e18..2c59fbf02 100644 --- a/tests/test_editblock.py +++ b/tests/test_editblock.py @@ -215,6 +215,26 @@ These changes replace the `subprocess.run` patches with `subprocess.check_output self.assertEqual(edit_blocks[0][0], "tests/test_repomap.py") self.assertEqual(edit_blocks[1][0], "tests/test_repomap.py") + def test_replace_part_with_missing_varied_leading_whitespace(self): + whole = """ + line1 + line2 + line3 + line4 +""" + + part = "line2\n line3\n" + replace = "new_line2\n new_line3\n" + expected_output = """ + line1 + new_line2 + new_line3 + line4 +""" + + result = eb.replace_part_with_missing_leading_whitespace(whole, part, replace) + self.assertEqual(result, expected_output) + def test_replace_part_with_missing_leading_whitespace(self): whole = " line1\n line2\n line3\n" part = "line1\nline2"