[3.11] gh-106368: Increase Argument Clinic test coverage (GH-106389) (#106391)

Add:

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

Co-authored-by: Erlend E. Aasland <erlend@python.org>
This commit is contained in:
Miss Islington (bot) 2023-07-03 17:22:32 -07:00 committed by GitHub
parent 76889641e6
commit 3cc5c4a073
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View 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