mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-115015: Argument Clinic: fix generated code for METH_METHOD methods without params (#115016)
This commit is contained in:
parent
4aa4f0906d
commit
09096a1647
30 changed files with 153 additions and 68 deletions
|
@ -3288,6 +3288,26 @@ class ClinicFunctionalTest(unittest.TestCase):
|
|||
func = getattr(ac_tester, name)
|
||||
self.assertEqual(func(), name)
|
||||
|
||||
def test_meth_method_no_params(self):
|
||||
obj = ac_tester.TestClass()
|
||||
meth = obj.meth_method_no_params
|
||||
check = partial(self.assertRaisesRegex, TypeError, "no arguments")
|
||||
check(meth, 1)
|
||||
check(meth, a=1)
|
||||
|
||||
def test_meth_method_no_params_capi(self):
|
||||
from _testcapi import pyobject_vectorcall
|
||||
obj = ac_tester.TestClass()
|
||||
meth = obj.meth_method_no_params
|
||||
pyobject_vectorcall(meth, None, None)
|
||||
pyobject_vectorcall(meth, (), None)
|
||||
pyobject_vectorcall(meth, (), ())
|
||||
pyobject_vectorcall(meth, None, ())
|
||||
|
||||
check = partial(self.assertRaisesRegex, TypeError, "no arguments")
|
||||
check(pyobject_vectorcall, meth, (1,), None)
|
||||
check(pyobject_vectorcall, meth, (1,), ("a",))
|
||||
|
||||
def test_depr_star_new(self):
|
||||
cls = ac_tester.DeprStarNew
|
||||
cls()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue