Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions tests/data/cases/context_managers_39.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,25 +90,6 @@ async def func():
pass


# don't remove the brackets here, it changes the meaning of the code.
# even though the code will always trigger a runtime error
with (name_5, name_4), name_5:
pass


def test_tuple_as_contextmanager():
from contextlib import nullcontext

try:
with (nullcontext(),nullcontext()),nullcontext():
pass
except TypeError:
# test passed
pass
else:
# this should be a type error
assert False

# output


Expand Down Expand Up @@ -202,23 +183,3 @@ async def func():
# don't remove the brackets here, it changes the meaning of the code.
with (x, y) as z:
pass


# don't remove the brackets here, it changes the meaning of the code.
# even though the code will always trigger a runtime error
with (name_5, name_4), name_5:
pass


def test_tuple_as_contextmanager():
from contextlib import nullcontext

try:
with (nullcontext(), nullcontext()), nullcontext():
pass
except TypeError:
# test passed
pass
else:
# this should be a type error
assert False
30 changes: 30 additions & 0 deletions tests/data/cases/tuple_with_stmt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# don't remove the brackets here, it changes the meaning of the code.
# even though the code will always trigger a runtime error
with (name_5, name_4), name_5:
pass


with c, (a, b):
pass


with c, (a, b), d:
pass


with c, (a, b, e, f, g), d:
pass


def test_tuple_as_contextmanager():
from contextlib import nullcontext

try:
with (nullcontext(), nullcontext()), nullcontext():
pass
except TypeError:
# test passed
pass
else:
# this should be a type error
assert False
Loading