Skip to content

Commit

Permalink
gh-106368: Argument Clinic: Test that keyword params are disallowed i…
Browse files Browse the repository at this point in the history
…n groups (#107985)
  • Loading branch information
erlend-aasland authored Aug 16, 2023
1 parent bdd8ddf commit 57a20b0
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Lib/test/test_clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1524,6 +1524,27 @@ def test_disallowed_grouping__no_matching_bracket(self):
err = "Function 'empty_group' has a ']' without a matching '['"
self.expect_failure(block, err)

def test_disallowed_grouping__must_be_position_only(self):
dataset = ("""
with_kwds
[
*
a: object
]
""", """
with_kwds
[
a: object
]
""")
err = (
"You cannot use optional groups ('[' and ']') unless all "
"parameters are positional-only ('/')"
)
for block in dataset:
with self.subTest(block=block):
self.expect_failure(block, err)

def test_no_parameters(self):
function = self.parse_function("""
module foo
Expand Down

0 comments on commit 57a20b0

Please sign in to comment.