Skip to content

gh-106368: Argument Clinic: Test that keyword params are disallowed in groups #107985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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