]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106368: Increase Argument Clinic test coverage (#106389)
authorErlend E. Aasland <erlend@python.org>
Mon, 3 Jul 2023 23:58:27 +0000 (01:58 +0200)
committerGitHub <noreply@github.com>
Mon, 3 Jul 2023 23:58:27 +0000 (23:58 +0000)
Add:

- test_disallowed_gropuing__no_matching_bracket
- test_double_slash

Lib/test/test_clinic.py

index c5cfe53e0df99ba80a93a2a535fbf88c93bb463b..03754d0bf123bec4b615f3572da8fdf849257e4b 100644 (file)
@@ -730,6 +730,18 @@ class ClinicParserTest(TestCase):
         )
         self.assertIn(msg, out)
 
+    def test_disallowed_grouping__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 @@ class ClinicParserTest(TestCase):
         )
         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