mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
bpo-44566: resolve differences between asynccontextmanager and contextmanager (GH-27024) (#27266)
(cherry picked from commit 7f1c330da3)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
This commit is contained in:
parent
574da4633b
commit
68b4690b01
4 changed files with 85 additions and 56 deletions
|
|
@ -209,7 +209,18 @@ async def test_contextmanager_except_stopiter(self):
|
|||
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():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue