mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
gh-106368: Argument clinic: Fix minor bug in state_modulename_name
(#107387)
This commit is contained in:
parent
3a1d819ebc
commit
ecc05e23a1
2 changed files with 20 additions and 5 deletions
|
@ -84,6 +84,7 @@ class FakeClinic:
|
|||
('parser_definition', d('block')),
|
||||
('impl_definition', d('block')),
|
||||
))
|
||||
self.functions = []
|
||||
|
||||
def get_destination(self, name):
|
||||
d = self.destinations.get(name)
|
||||
|
@ -104,6 +105,9 @@ class FakeClinic:
|
|||
|
||||
_module_and_class = clinic.Clinic._module_and_class
|
||||
|
||||
def __repr__(self):
|
||||
return "<FakeClinic object>"
|
||||
|
||||
|
||||
class ClinicWholeFileTest(_ParserBase):
|
||||
def setUp(self):
|
||||
|
@ -672,6 +676,19 @@ class ClinicParserTest(_ParserBase):
|
|||
""")
|
||||
self.assertEqual("os_stat_fn", function.c_basename)
|
||||
|
||||
def test_cloning_nonexistent_function_correctly_fails(self):
|
||||
stdout = self.parse_function_should_fail("""
|
||||
cloned = fooooooooooooooooooooooo
|
||||
This is trying to clone a nonexistent function!!
|
||||
""")
|
||||
expected_error = """\
|
||||
cls=None, module=<FakeClinic object>, existing='fooooooooooooooooooooooo'
|
||||
(cls or module).functions=[]
|
||||
Error on line 0:
|
||||
Couldn't find existing function 'fooooooooooooooooooooooo'!
|
||||
"""
|
||||
self.assertEqual(expected_error, stdout)
|
||||
|
||||
def test_return_converter(self):
|
||||
function = self.parse_function("""
|
||||
module os
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue