diff options
| author | Erlend E. Aasland <erlend@python.org> | 2023-08-16 10:39:56 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-08-16 10:39:56 (GMT) |
| commit | 57a20b0960f5c087a476b34c72f608580746cab5 (patch) | |
| tree | ab4b4b805ecc27732b2aad8f1e40469a16b9f431 | |
| parent | bdd8ddfda166d1ed49744d61dcc486d62a9ac890 (diff) | |
| download | cpython-57a20b0960f5c087a476b34c72f608580746cab5.zip cpython-57a20b0960f5c087a476b34c72f608580746cab5.tar.gz cpython-57a20b0960f5c087a476b34c72f608580746cab5.tar.bz2 | |
gh-106368: Argument Clinic: Test that keyword params are disallowed in groups (#107985)
| -rw-r--r-- | Lib/test/test_clinic.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py index 76729c8..32aac40 100644 --- a/Lib/test/test_clinic.py +++ b/Lib/test/test_clinic.py @@ -1524,6 +1524,27 @@ class ClinicParserTest(TestCase): 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 |
