summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2024-07-25 07:12:26 (GMT)
committerGitHub <noreply@github.com>2024-07-25 07:12:26 (GMT)
commitbb108580dec5d8655ccdfb6c8737b5f64e3366d0 (patch)
treec3bb5e20872f474ea38987a2068de46c025d8965 /Lib
parenta3327dbfd4db9e5ad1ca514963d503abbbbfede7 (diff)
downloadcpython-bb108580dec5d8655ccdfb6c8737b5f64e3366d0.zip
cpython-bb108580dec5d8655ccdfb6c8737b5f64e3366d0.tar.gz
cpython-bb108580dec5d8655ccdfb6c8737b5f64e3366d0.tar.bz2
gh-122087: Add tests for ismethoddescriptor() and isroutine() with partial objects (GH-122219)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_inspect/test_inspect.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/test/test_inspect/test_inspect.py b/Lib/test/test_inspect/test_inspect.py
index 5521528..730c192 100644
--- a/Lib/test/test_inspect/test_inspect.py
+++ b/Lib/test/test_inspect/test_inspect.py
@@ -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):