diff options
author | Alex Waygood <Alex.Waygood@Gmail.com> | 2023-07-27 21:51:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-27 21:51:18 (GMT) |
commit | c2b1689abcfa80ad959862168b5260fbbd478484 (patch) | |
tree | ca1369ee673096abea930eab1914684d060809dd /Lib | |
parent | 2f9bb77764c3b41867f79d6df6e2ed71715dad63 (diff) | |
download | cpython-c2b1689abcfa80ad959862168b5260fbbd478484.zip cpython-c2b1689abcfa80ad959862168b5260fbbd478484.tar.gz cpython-c2b1689abcfa80ad959862168b5260fbbd478484.tar.bz2 |
gh-104683: Argument clinic: cleanup `state_modulename_name()` (#107340)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_clinic.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/Lib/test/test_clinic.py b/Lib/test/test_clinic.py index d1c61b1..d21c7d8 100644 --- a/Lib/test/test_clinic.py +++ b/Lib/test/test_clinic.py @@ -679,6 +679,32 @@ class ClinicParserTest(_ParserBase): """) self.assertIsInstance(function.return_converter, clinic.int_return_converter) + def test_return_converter_invalid_syntax(self): + stdout = self.parse_function_should_fail(""" + module os + os.stat -> invalid syntax + """) + expected_error = "Badly formed annotation for os.stat: 'invalid syntax'" + self.assertIn(expected_error, stdout) + + def test_legacy_converter_disallowed_in_return_annotation(self): + stdout = self.parse_function_should_fail(""" + module os + os.stat -> "s" + """) + expected_error = "Legacy converter 's' not allowed as a return converter" + self.assertIn(expected_error, stdout) + + def test_unknown_return_converter(self): + stdout = self.parse_function_should_fail(""" + module os + os.stat -> foooooooooooooooooooooooo + """) + expected_error = ( + "No available return converter called 'foooooooooooooooooooooooo'" + ) + self.assertIn(expected_error, stdout) + def test_star(self): function = self.parse_function(""" module os |