Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jakkdl committed May 29, 2024
1 parent bffc30c commit f383fe6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions tests/eval_files/async112.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,34 +9,34 @@
import trio as noterror

# error
with trio.open_nursery() as n: # error: 5, "n"
with trio.open_nursery() as n: # error: 5, "n", "nursery"
n.start(...)

with trio.open_nursery(...) as nurse: # error: 5, "nurse"
with trio.open_nursery(...) as nurse: # error: 5, "nurse", "nursery"
nurse.start_soon(...)

with trio.open_nursery() as n: # error: 5, "n"
with trio.open_nursery() as n: # error: 5, "n", "nursery"
n.start_soon(n=7)


async def foo():
async with trio.open_nursery() as n: # error: 15, "n"
async with trio.open_nursery() as n: # error: 15, "n", "nursery"
n.start(...)


# weird ones with multiple `withitem`s
# but if split among several `with` they'd all be treated as error (or ASYNC111), so
# treating as error for now.
with trio.open_nursery() as n, trio.open("") as n: # error: 5, "n"
with trio.open_nursery() as n, trio.open("") as n: # error: 5, "n", "nursery"
n.start(...)

with open("") as o, trio.open_nursery() as n: # error: 20, "n"
with open("") as o, trio.open_nursery() as n: # error: 20, "n", "nursery"
n.start(o)

with trio.open_nursery() as n, trio.open_nursery() as nurse: # error: 31, "nurse"
with trio.open_nursery() as n, trio.open_nursery() as nurse: # error: 31, "nurse", "nursery"
nurse.start(n.start(...))

with trio.open_nursery() as n, trio.open_nursery() as n: # error: 5, "n" # error: 31, "n"
with trio.open_nursery() as n, trio.open_nursery() as n: # error: 5, "n", "nursery" # error: 31, "n", "nursery"
n.start(...)

# safe if passing variable as parameter
Expand Down Expand Up @@ -83,7 +83,7 @@ async def foo():

# body is a call to await n.start
async def foo_1():
with trio.open_nursery(...) as n: # error: 9, "n"
with trio.open_nursery(...) as n: # error: 9, "n", "nursery"
await n.start(...)


Expand Down
4 changes: 2 additions & 2 deletions tests/eval_files/async112_anyio.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ async def bar(*args): ...


async def foo():
async with anyio.create_task_group() as tg: # error: 15, "tg"
async with anyio.create_task_group() as tg: # error: 15, "tg", "taskgroup"
await tg.start_soon(bar())

async with anyio.create_task_group() as tg:
await tg.start(bar(tg))

async with anyio.create_task_group() as tg: # error: 15, "tg"
async with anyio.create_task_group() as tg: # error: 15, "tg", "taskgroup"
tg.start_soon(bar())

async with anyio.create_task_group() as tg:
Expand Down
2 changes: 1 addition & 1 deletion tests/eval_files/async112_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async def bar(*args): ...


async def foo():
async with asyncio.TaskGroup() as tg: # error: 15, "tg"
async with asyncio.TaskGroup() as tg: # error: 15, "tg", "taskgroup"
tg.create_task(bar())

async with asyncio.TaskGroup() as tg:
Expand Down

0 comments on commit f383fe6

Please sign in to comment.