From 10f6449e3d514eb2037f9d5cadddc6eb049477aa Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Mon, 11 Dec 2023 13:24:35 -0800 Subject: [PATCH] fix some tests --- .../attribute_access_on_number_literals.py | 3 ++- .../cases/parenthesized_context_managers.py | 18 ++++++++++++------ tests/data/cases/remove_with_brackets.py | 12 ++++++++---- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/tests/data/cases/attribute_access_on_number_literals.py b/tests/data/cases/attribute_access_on_number_literals.py index 1b4dbbc..7c16bdf 100644 --- a/tests/data/cases/attribute_access_on_number_literals.py +++ b/tests/data/cases/attribute_access_on_number_literals.py @@ -40,7 +40,8 @@ x = (0.000000006).hex() x = -100.0000j -if (10).real: ... +if (10).real: + ... y = 100[no] y = 100(no) diff --git a/tests/data/cases/parenthesized_context_managers.py b/tests/data/cases/parenthesized_context_managers.py index 538eff7..16645a1 100644 --- a/tests/data/cases/parenthesized_context_managers.py +++ b/tests/data/cases/parenthesized_context_managers.py @@ -23,18 +23,24 @@ # output -with CtxManager() as example: ... +with CtxManager() as example: + ... -with CtxManager1(), CtxManager2(): ... +with CtxManager1(), CtxManager2(): + ... -with CtxManager1() as example, CtxManager2(): ... +with CtxManager1() as example, CtxManager2(): + ... -with CtxManager1(), CtxManager2() as example: ... +with CtxManager1(), CtxManager2() as example: + ... -with CtxManager1() as example1, CtxManager2() as example2: ... +with CtxManager1() as example1, CtxManager2() as example2: + ... with ( CtxManager1() as example1, CtxManager2() as example2, CtxManager3() as example3, -): ... +): + ... diff --git a/tests/data/cases/remove_with_brackets.py b/tests/data/cases/remove_with_brackets.py index f90b158..3ee6490 100644 --- a/tests/data/cases/remove_with_brackets.py +++ b/tests/data/cases/remove_with_brackets.py @@ -75,13 +75,15 @@ with open("bla.txt") as f, open("x"): pass -with CtxManager1() as example1, CtxManager2() as example2: ... +with CtxManager1() as example1, CtxManager2() as example2: + ... # Brackets remain when using magic comma with ( CtxManager1() as example1, CtxManager2() as example2, -): ... +): + ... # Brackets remain for multi-line context managers with ( @@ -90,7 +92,8 @@ CtxManager2() as example2, CtxManager2() as example2, CtxManager2() as example2, -): ... +): + ... # Don't touch assignment expressions with (y := open("./test.py")) as f: @@ -113,4 +116,5 @@ with open("bla.txt") as f: pass -with CtxManager1() as example1, CtxManager2() as example2: ... +with CtxManager1() as example1, CtxManager2() as example2: + ...