diff --git a/tests/data/cases/context_managers_39.py b/tests/data/cases/context_managers_39.py index f4934cb07e4..7f1ee2d576b 100644 --- a/tests/data/cases/context_managers_39.py +++ b/tests/data/cases/context_managers_39.py @@ -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 @@ -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 diff --git a/tests/data/cases/tuple_with_stmt.py b/tests/data/cases/tuple_with_stmt.py new file mode 100644 index 00000000000..885a300f446 --- /dev/null +++ b/tests/data/cases/tuple_with_stmt.py @@ -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