gh-142418 Enhance markcoroutinefunction to support functools.partial by chaope · Pull Request #142505 · python/cpython · GitHub
Skip to content
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions Lib/inspect.py
11 changes: 11 additions & 0 deletions Lib/test/test_inspect/test_inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,17 @@ def do_something_static():
self.assertTrue(inspect.iscoroutinefunction(Cl3.do_something_classy))
self.assertTrue(inspect.iscoroutinefunction(Cl3.do_something_static))

# Test markcoroutinefunction with functools.partial
async def _fn4():
pass

def fn4():
return _fn4()

partial_fn4 = functools.partial(fn4)
marked_partial_fn4 = inspect.markcoroutinefunction(partial_fn4)
self.assertTrue(inspect.iscoroutinefunction(marked_partial_fn4))

self.assertFalse(
inspect.iscoroutinefunction(unittest.mock.Mock()))
self.assertTrue(
Expand Down
Loading