-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add async121 control-flow-in-taskgroup
- Loading branch information
Showing
6 changed files
with
195 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# ASYNCIO_NO_ERROR # not a problem in asyncio | ||
# ANYIO_NO_ERROR # checked in async121_anyio.py | ||
|
||
import trio | ||
|
||
|
||
async def foo_return(): | ||
async with trio.open_nursery(): | ||
return # ASYNC121: 8, "return", "nursery" | ||
|
||
|
||
async def foo_return_nested(): | ||
async with trio.open_nursery(): | ||
|
||
def bar(): | ||
return # safe | ||
|
||
|
||
# continue | ||
async def foo_while_continue_safe(): | ||
async with trio.open_nursery(): | ||
while True: | ||
continue # safe | ||
|
||
|
||
async def foo_while_continue_unsafe(): | ||
while True: | ||
async with trio.open_nursery(): | ||
continue # ASYNC121: 12, "continue", "nursery" | ||
|
||
|
||
async def foo_for_continue_safe(): | ||
async with trio.open_nursery(): | ||
for _ in range(5): | ||
continue # safe | ||
|
||
|
||
async def foo_for_continue_unsafe(): | ||
for _ in range(5): | ||
async with trio.open_nursery(): | ||
continue # ASYNC121: 12, "continue", "nursery" | ||
|
||
|
||
# break | ||
async def foo_while_break_safe(): | ||
async with trio.open_nursery(): | ||
while True: | ||
break # safe | ||
|
||
|
||
async def foo_while_break_unsafe(): | ||
while True: | ||
async with trio.open_nursery(): | ||
break # ASYNC121: 12, "break", "nursery" | ||
|
||
|
||
async def foo_for_break_safe(): | ||
async with trio.open_nursery(): | ||
for _ in range(5): | ||
break # safe | ||
|
||
|
||
async def foo_for_break_unsafe(): | ||
for _ in range(5): | ||
async with trio.open_nursery(): | ||
break # ASYNC121: 12, "break", "nursery" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# ASYNCIO_NO_ERROR # not a problem in asyncio | ||
# TRIO_NO_ERROR # checked in async121.py | ||
# BASE_LIBRARY anyio | ||
|
||
import anyio | ||
|
||
|
||
async def foo_return(): | ||
async with anyio.create_task_group(): | ||
return # ASYNC121: 8, "return", "task group" | ||
|
||
|
||
async def foo_return_nested(): | ||
async with anyio.create_task_group(): | ||
|
||
def bar(): | ||
return # safe | ||
|
||
|
||
# continue | ||
async def foo_while_continue_safe(): | ||
async with anyio.create_task_group(): | ||
while True: | ||
continue # safe | ||
|
||
|
||
async def foo_while_continue_unsafe(): | ||
while True: | ||
async with anyio.create_task_group(): | ||
continue # ASYNC121: 12, "continue", "task group" | ||
|
||
|
||
async def foo_for_continue_safe(): | ||
async with anyio.create_task_group(): | ||
for _ in range(5): | ||
continue # safe | ||
|
||
|
||
async def foo_for_continue_unsafe(): | ||
for _ in range(5): | ||
async with anyio.create_task_group(): | ||
continue # ASYNC121: 12, "continue", "task group" | ||
|
||
|
||
# break | ||
async def foo_while_break_safe(): | ||
async with anyio.create_task_group(): | ||
while True: | ||
break # safe | ||
|
||
|
||
async def foo_while_break_unsafe(): | ||
while True: | ||
async with anyio.create_task_group(): | ||
break # ASYNC121: 12, "break", "task group" | ||
|
||
|
||
async def foo_for_break_safe(): | ||
async with anyio.create_task_group(): | ||
for _ in range(5): | ||
break # safe | ||
|
||
|
||
async def foo_for_break_unsafe(): | ||
for _ in range(5): | ||
async with anyio.create_task_group(): | ||
break # ASYNC121: 12, "break", "task group" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters