mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-84753: Make inspect.iscoroutinefunction() work with AsyncMock (GH-94050) (GH-94461)
The inspect version was not working with unittest.mock.AsyncMock.
The fix introduces special-casing of AsyncMock in
`inspect.iscoroutinefunction` equivalent to the one
performed in `asyncio.iscoroutinefunction`.
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 4261b6bffc)
Co-authored-by: Mehdi ABAAKOUK <sileht@sileht.net>
This commit is contained in:
parent
d915ed2978
commit
47f23b2d8a
5 changed files with 23 additions and 1 deletions
|
|
@ -1723,6 +1723,7 @@ def fn2():
|
|||
self.assertTrue(asyncio.iscoroutinefunction(fn2))
|
||||
|
||||
self.assertFalse(asyncio.iscoroutinefunction(mock.Mock()))
|
||||
self.assertTrue(asyncio.iscoroutinefunction(mock.AsyncMock()))
|
||||
|
||||
def test_yield_vs_yield_from(self):
|
||||
fut = self.new_future(self.loop)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue