From 2e2b42f3e079dbcaf580eef7ad72ea2265fc7352 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Tue, 4 Jul 2023 01:09:29 +0200 Subject: [PATCH 1/2] gh-106368: Increase Argument Clinic test coverage Add: - test_disallowed_gropuing__no_matching_bracket - test_double_slash --- Lib/test/test_clinic.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py index c5cfe53e0df99b..76ab2db1bdfb45 100644 --- a/Lib/test/test_clinic.py +++ b/Lib/test/test_clinic.py @@ -730,6 +730,18 @@ def test_disallowed_grouping__empty_group_on_right(self): ) self.assertIn(msg, out) + def test_disallowed_gropuing__no_matching_bracket(self): + out = self.parse_function_should_fail(""" + module foo + foo.empty_group + param: int + ] + group2: int + ] + """) + msg = "Function empty_group has a ] without a matching [." + self.assertIn(msg, out) + def test_no_parameters(self): function = self.parse_function(""" module foo @@ -809,6 +821,18 @@ def test_single_slash(self): ) self.assertIn(msg, out) + def test_double_slash(self): + out = self.parse_function_should_fail(""" + module foo + foo.bar + a: int + / + b: int + / + """) + msg = "Function bar uses '/' more than once." + self.assertIn(msg, out) + def test_mix_star_and_slash(self): out = self.parse_function_should_fail(""" module foo From 90597cbb58057160dfea6623d7a5b476717b0d78 Mon Sep 17 00:00:00 2001 From: "Erlend E. Aasland" Date: Tue, 4 Jul 2023 01:32:16 +0200 Subject: [PATCH 2/2] Update Lib/test/test_clinic.py Co-authored-by: Alex Waygood --- Lib/test/test_clinic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py index 76ab2db1bdfb45..03754d0bf123be 100644 --- a/Lib/test/test_clinic.py +++ b/Lib/test/test_clinic.py @@ -730,7 +730,7 @@ def test_disallowed_grouping__empty_group_on_right(self): ) self.assertIn(msg, out) - def test_disallowed_gropuing__no_matching_bracket(self): + def test_disallowed_grouping__no_matching_bracket(self): out = self.parse_function_should_fail(""" module foo foo.empty_group