mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-94808: Cover PyEval_GetFuncName
(#98246)
This commit is contained in:
parent
120b4ab2b6
commit
f01b56c7bd
2 changed files with 22 additions and 0 deletions
|
@ -880,6 +880,21 @@ class CAPITest(unittest.TestCase):
|
|||
_testcapi.clear_managed_dict(c)
|
||||
self.assertEqual(c.__dict__, {})
|
||||
|
||||
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