X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/0a833b4b14953f98e81d632281a75318faa66170..db30456916ca733d011a2774e66beb3dd7064e14:/tests/data/pep_572_remove_parens.py?ds=inline diff --git a/tests/data/pep_572_remove_parens.py b/tests/data/pep_572_remove_parens.py index 04cc75b..9a80485 100644 --- a/tests/data/pep_572_remove_parens.py +++ b/tests/data/pep_572_remove_parens.py @@ -17,6 +17,32 @@ test: int = (test2 := 2) a, b = (test := (1, 2)) +# see also https://github.com/psf/black/issues/2139 +assert (foo := 42 - 12) + +foo(x=(y := f(x))) + + +def foo(answer=(p := 42)): + ... + + +def foo2(answer: (p := 42) = 5): + ... + + +lambda: (x := 1) + +# we don't touch expressions in f-strings but if we do one day, don't break 'em +f'{(x:=10)}' + + +def a(): + return (x := 3) + await (b := 1) + yield (a := 2) + raise (c := 3) + # output if foo := 0: pass @@ -36,3 +62,29 @@ y += (x := 0) test: int = (test2 := 2) a, b = (test := (1, 2)) + +# see also https://github.com/psf/black/issues/2139 +assert (foo := 42 - 12) + +foo(x=(y := f(x))) + + +def foo(answer=(p := 42)): + ... + + +def foo2(answer: (p := 42) = 5): + ... + + +lambda: (x := 1) + +# we don't touch expressions in f-strings but if we do one day, don't break 'em +f"{(x:=10)}" + + +def a(): + return (x := 3) + await (b := 1) + yield (a := 2) + raise (c := 3)