mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
Issue 24315: Make collections.abc.Coroutine derived from Awaitable
This commit is contained in:
parent
8fa6d4f753
commit
56fc614025
4 changed files with 67 additions and 40 deletions
|
@ -97,18 +97,14 @@ class CoroutineTests(BaseTest):
|
|||
finally:
|
||||
f.close() # silence warning
|
||||
|
||||
class FakeCoro(collections.abc.Coroutine):
|
||||
# Test that asyncio.iscoroutine() uses collections.abc.Coroutine
|
||||
class FakeCoro:
|
||||
def send(self, value): pass
|
||||
def throw(self, typ, val=None, tb=None): pass
|
||||
def close(self): pass
|
||||
def __await__(self): yield
|
||||
|
||||
fc = FakeCoro()
|
||||
try:
|
||||
self.assertTrue(asyncio.iscoroutine(fc))
|
||||
finally:
|
||||
# To make sure that ABCMeta caches are freed
|
||||
# from FakeCoro ASAP.
|
||||
fc = FakeCoro = None
|
||||
support.gc_collect()
|
||||
self.assertTrue(asyncio.iscoroutine(FakeCoro()))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue