From 13df37f63830134a3d87a0f56b37960f1b1d7a0a Mon Sep 17 00:00:00 2001 From: Marco Ricci Date: Sun, 1 Sep 2024 22:22:02 +0200 Subject: [PATCH] test: add whitespace variants for the test for #1828 Test various configurations of whitespace before a continuation backslash. Previously, only the "no whitespace" version was tested, which prompted the followup on #1828. Signed-off-by: Marco Ricci --- tests/test_html.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/test_html.py b/tests/test_html.py index d5cc0f3012d8..58ebdbe0deec 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -1175,10 +1175,14 @@ assert len(math) == 18 doesnt_contain("out/tabbed_py.html", "\t") - def test_bug_1828(self) -> None: + @pytest.mark.parametrize( + "whitespace", ["", " ", "\t", " \t", " \t \t"], + ids=["no_spaces", "spaces", "tabs", "mixed_single", "mixed_double"] + ) + def test_bug_1828(self, whitespace) -> None: # https://github.com/nedbat/coveragepy/pull/1828 - self.make_file("backslashes.py", """\ - a = ["aaa",\\ + self.make_file("backslashes.py", f"""\ + a = ["aaa",{whitespace}\\ "bbb \\ ccc"] """) @@ -1198,7 +1202,7 @@ assert len(math) == 18 ) assert self.get_html_report_text_lines("backslashes.py") == [ - '1a = ["aaa",\\', + '1' + f'a = ["aaa",{whitespace}\\'.expandtabs(), '2 "bbb \\', '3 ccc"]', ] -- 2.43.0