From fbbb3d1c877464d36ce1b041b0cbcf73d1834c37 Mon Sep 17 00:00:00 2001 From: Xinlong Hu Date: Fri, 11 Jul 2025 15:46:24 -0500 Subject: [PATCH] Alphabetizing With test cases + explanations on fails --- test/{with.py => With.py} | 205 ++++++++++++++++---------------------- 1 file changed, 86 insertions(+), 119 deletions(-) rename test/{with.py => With.py} (51%) diff --git a/test/with.py b/test/With.py similarity index 51% rename from test/with.py rename to test/With.py index e6359fa..0d3fd32 100644 --- a/test/with.py +++ b/test/With.py @@ -1,165 +1,73 @@ -def bare_with(): +def a_bare_with(): with a: print(1) - -def bare_with_fallthrough(): +def a1_bare_with_fallthrough(): with a: print(1) print(2) - -## Known to fail on 3.10 -def multi_with(): +# Fails in 3.10, duplicate blocks explained further in issue 32 +def b_multi_with(): with a, b: print(1) - -def multi_with_fallthrough(): +def b1_multi_with_fallthrough(): with a, b: print(1) print(2) - -def with_as(): +def c_with_as(): with a as c: print(1) - -def with_as_fallthrough(): +def c1_with_as_fallthrough(): with a as c: print(1) print(2) - -def multi_with_as(): +# Fails in 3.10, same issue as b +def d_multi_with_as(): with a, b as c: print(1) - -def multi_with_as_fallthrough(): +def d1_multi_with_as_fallthrough(): with a, b as c: print(1) print(2) - -def with_multi_as(): +# Fails in 3.10, same issue as b +def e_with_multi_as(): with a as b, c: print(1) - -def with_multi_as_fallthrough(): +def e1_with_multi_as_fallthrough(): with a as b, c: print(1) print(2) - -def multi_with_multi_as(): +# Fails in 3.10, same issue as b +def f_multi_with_multi_as(): with a as b, c as d: print(1) - -# Known to fail on 3.10 -def multi_with_multi_as_fallthrough(): +def f1_multi_with_multi_as_fallthrough(): with a as b, c as d: print(1) print(2) - -def multi_with_multi_as_alt(): +# Fails in 3.10, same issue as b +def g_multi_with_multi_as_alt(): with a, b as c, d: print(1) - -# Known to fail on 3.10 -def multi_with_multi_as_fallthrough_alt(): +def g1_multi_with_multi_as_fallthrough_alt(): with a, b as c, d: print(1) print(2) - -async def bare_async_with(): - async with a: - print(1) - - -async def bare_async_with_fallthrough(): - async with a: - print(1) - print(2) - - -## Known to fail on 3.10 -async def multi_async_with(): - async with a, b: - print(1) - - -async def multi_async_with_fallthrough(): - async with a, b: - print(1) - print(2) - - -async def with_as(): - async with a as c: - print(1) - - -async def with_as_fallthrough(): - async with a as c: - print(1) - print(2) - - -async def multi_async_with_as(): - async with a, b as c: - print(1) - - -async def multi_async_with_as_fallthrough(): - async with a, b as c: - print(1) - print(2) - - -async def with_multi_as(): - async with a as b, c: - print(1) - - -async def with_multi_as_fallthrough(): - async with a as b, c: - print(1) - print(2) - - -async def multi_async_with_multi_as(): - async with a as b, c as d: - print(1) - - -# Known to fail on 3.10 -async def multi_async_with_multi_as_fallthrough(): - async with a as b, c as d: - print(1) - print(2) - - -async def multi_async_with_multi_as_alt(): - async with a, b as c, d: - print(1) - - -# Known to fail on 3.10 -async def multi_async_with_multi_as_fallthrough_alt(): - async with a, b as c, d: - print(1) - print(2) - - -def try_with_except(): - # With statement with outer exception handler +# Fails in 3.13, unexpected JUMP_BACKWARD_NO_INTERRUPT messes up the template +def h_try_with_except(): try: with a: print(1) @@ -167,16 +75,75 @@ def try_with_except(): print(2) print(3) - -def with_return(): - # With statement with return +def i_with_return(): with a: return 1 print(1) - -def with_raise(): - # With statement with raise +def j_with_raise(): with a: raise Exc print(1) + +async def k_bare_async_with(): + async with a: + print(1) + +async def k1_bare_async_with_fallthrough(): + async with a: + print(1) + print(2) + +async def l_multi_async_with(): + async with a, b: + print(1) + +async def l1_multi_async_with_fallthrough(): + async with a, b: + print(1) + print(2) + +async def m_async_with_as(): + async with a as c: + print(1) + +async def m1_async_with_as_fallthrough(): + async with a as c: + print(1) + print(2) + +async def n_multi_async_with_as(): + async with a, b as c: + print(1) + +async def n1_multi_async_with_as_fallthrough(): + async with a, b as c: + print(1) + print(2) + +async def o_async_with_multi_as(): + async with a as b, c: + print(1) + +async def o1_async_with_multi_as_fallthrough(): + async with a as b, c: + print(1) + print(2) + +async def p_multi_async_with_multi_as(): + async with a as b, c as d: + print(1) + +async def p1_multi_async_with_multi_as_fallthrough(): + async with a as b, c as d: + print(1) + print(2) + +async def q_multi_async_with_multi_as_alt(): + async with a, b as c, d: + print(1) + +async def q1_multi_async_with_multi_as_fallthrough_alt(): + async with a, b as c, d: + print(1) + print(2) \ No newline at end of file