Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
gh-122087: Add tests for ismethoddescriptor() and isroutine() with pa…
…rtial objects
  • Loading branch information
serhiy-storchaka committed Jul 24, 2024
commit f10bf09d40415c060a1bd2b6e48eb0424c30bbe9
3 changes: 3 additions & 0 deletions Lib/test/test_inspect/test_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@ def test_isroutine(self):
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')
Expand Down Expand Up @@ -1693,6 +1695,7 @@ def function():
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):
Expand Down