]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-106368: Increase Argument Clinic test coverage (GH-106389) (#106391)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Tue, 4 Jul 2023 00:22:32 +0000 (17:22 -0700)
committerGitHub <noreply@github.com>
Tue, 4 Jul 2023 00:22:32 +0000 (00:22 +0000)
Add:

- test_disallowed_gropuing__no_matching_bracket
- test_double_slash
(cherry picked from commit 3406f8cce542ea4edf4153c0fac5216df283a9b1)

Co-authored-by: Erlend E. Aasland <erlend@python.org>
Lib/test/test_clinic.py

index f107e14e38f20ff35f481f9592f264eaf8002af7..dafdfc2240d0d20af37826ad9b3bf35776ceb7e1 100644 (file)
@@ -729,6 +729,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
@@ -808,6 +820,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