bpo-44566: resolve differences between asynccontextmanager and contextmanager (#27024)

This commit is contained in:
Thomas Grainger 2021-07-20 19:15:07 +01:00 committed by GitHub
parent 85fa3b6b7c
commit 7f1c330da3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 116 additions and 87 deletions

View file

@ -209,7 +209,18 @@ class AsyncContextManagerTestCase(unittest.TestCase):
async def woohoo():
yield
for stop_exc in (StopIteration('spam'), StopAsyncIteration('ham')):
class StopIterationSubclass(StopIteration):
pass
class StopAsyncIterationSubclass(StopAsyncIteration):
pass
for stop_exc in (
StopIteration('spam'),
StopAsyncIteration('ham'),
StopIterationSubclass('spam'),
StopAsyncIterationSubclass('spam')
):
with self.subTest(type=type(stop_exc)):
try:
async with woohoo():