gh-122087: Add tests for ismethoddescriptor() and isroutine() with partial objects (GH-122219)

This commit is contained in:
Serhiy Storchaka 2024-07-25 10:12:26 +03:00 committed by GitHub
parent a3327dbfd4
commit bb108580de
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -402,6 +402,8 @@ class TestPredicates(IsTestBase):
self.assertFalse(inspect.isroutine(type))
self.assertFalse(inspect.isroutine(int))
self.assertFalse(inspect.isroutine(type('some_class', (), {})))
# partial
self.assertTrue(inspect.isroutine(functools.partial(mod.spam)))
def test_isclass(self):
self.istest(inspect.isclass, 'mod.StupidGit')
@ -1693,6 +1695,7 @@ class TestIsMethodDescriptor(unittest.TestCase):
self.assertFalse(inspect.ismethoddescriptor(Owner.static_method))
self.assertFalse(inspect.ismethoddescriptor(function))
self.assertFalse(inspect.ismethoddescriptor(a_lambda))
self.assertTrue(inspect.ismethoddescriptor(functools.partial(function)))
def test_descriptor_being_a_class(self):
class MethodDescriptorMeta(type):