mirror of
https://github.com/python/cpython.git
synced 2025-10-03 21:55:41 +00:00
[3.11] gh-94808: Cover PyEval_GetFuncName
(GH-98246). (#98283)
(cherry picked from commit f01b56c7bd
)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
This commit is contained in:
parent
099620b0ce
commit
93d0d9cfdd
2 changed files with 22 additions and 0 deletions
|
@ -724,6 +724,21 @@ class CAPITest(unittest.TestCase):
|
|||
with self.subTest(name=name):
|
||||
self.assertTrue(hasattr(ctypes.pythonapi, name))
|
||||
|
||||
def test_eval_get_func_name(self):
|
||||
def function_example(): ...
|
||||
|
||||
class A:
|
||||
def method_example(self): ...
|
||||
|
||||
self.assertEqual(_testcapi.eval_get_func_name(function_example),
|
||||
"function_example")
|
||||
self.assertEqual(_testcapi.eval_get_func_name(A.method_example),
|
||||
"method_example")
|
||||
self.assertEqual(_testcapi.eval_get_func_name(A().method_example),
|
||||
"method_example")
|
||||
self.assertEqual(_testcapi.eval_get_func_name(sum), "sum") # c function
|
||||
self.assertEqual(_testcapi.eval_get_func_name(A), "type")
|
||||
|
||||
|
||||
class TestPendingCalls(unittest.TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue