Skip to content

Commit 57a20b0

Browse files
gh-106368: Argument Clinic: Test that keyword params are disallowed in groups (#107985)
1 parent bdd8ddf commit 57a20b0

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

Lib/test/test_clinic.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,6 +1524,27 @@ def test_disallowed_grouping__no_matching_bracket(self):
15241524
err = "Function 'empty_group' has a ']' without a matching '['"
15251525
self.expect_failure(block, err)
15261526

1527+
def test_disallowed_grouping__must_be_position_only(self):
1528+
dataset = ("""
1529+
with_kwds
1530+
[
1531+
*
1532+
a: object
1533+
]
1534+
""", """
1535+
with_kwds
1536+
[
1537+
a: object
1538+
]
1539+
""")
1540+
err = (
1541+
"You cannot use optional groups ('[' and ']') unless all "
1542+
"parameters are positional-only ('/')"
1543+
)
1544+
for block in dataset:
1545+
with self.subTest(block=block):
1546+
self.expect_failure(block, err)
1547+
15271548
def test_no_parameters(self):
15281549
function = self.parse_function("""
15291550
module foo

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy