[Python-checkins] gh-106368: Argument Clinic: Test that keyword params are disallowed in groups (#107985)
erlend-aasland
webhook-mailer at python.org
Wed Aug 16 06:40:00 EDT 2023
https://github.com/python/cpython/commit/57a20b0960f5c087a476b34c72f608580746cab5
commit: 57a20b0960f5c087a476b34c72f608580746cab5
branch: main
author: Erlend E. Aasland <erlend at python.org>
committer: erlend-aasland <erlend.aasland at protonmail.com>
date: 2023-08-16T12:39:56+02:00
summary:
gh-106368: Argument Clinic: Test that keyword params are disallowed in groups (#107985)
files:
M Lib/test/test_clinic.py
diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py
index 76729c8c3e4f7..32aac407a028c 100644
--- a/Lib/test/test_clinic.py
+++ b/Lib/test/test_clinic.py
@@ -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
More information about the Python-checkins
mailing list