]> git.madduck.net Git - etc/vim.git/blob - tests/data/pep_572_remove_parens.py

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Add more tests for fancy whitespace (#2147)
[etc/vim.git] / tests / data / pep_572_remove_parens.py
1 if (foo := 0):
2     pass
3
4 if (foo := 1):
5     pass
6
7 if (y := 5 + 5):
8     pass
9
10 y = (x := 0)
11
12 y += (x := 0)
13
14 (y := 5 + 5)
15
16 test: int = (test2 := 2)
17
18 a, b = (test := (1, 2))
19
20 # see also https://github.com/psf/black/issues/2139
21 assert (foo := 42 - 12)
22
23 foo(x=(y := f(x)))
24
25
26 def foo(answer=(p := 42)):
27     ...
28
29
30 def foo2(answer: (p := 42) = 5):
31     ...
32
33
34 lambda: (x := 1)
35
36 # we don't touch expressions in f-strings but if we do one day, don't break 'em
37 f'{(x:=10)}'
38
39
40 def a():
41     return (x := 3)
42     await (b := 1)
43     yield (a := 2)
44     raise (c := 3)
45
46 # output
47 if foo := 0:
48     pass
49
50 if foo := 1:
51     pass
52
53 if y := 5 + 5:
54     pass
55
56 y = (x := 0)
57
58 y += (x := 0)
59
60 (y := 5 + 5)
61
62 test: int = (test2 := 2)
63
64 a, b = (test := (1, 2))
65
66 # see also https://github.com/psf/black/issues/2139
67 assert (foo := 42 - 12)
68
69 foo(x=(y := f(x)))
70
71
72 def foo(answer=(p := 42)):
73     ...
74
75
76 def foo2(answer: (p := 42) = 5):
77     ...
78
79
80 lambda: (x := 1)
81
82 # we don't touch expressions in f-strings but if we do one day, don't break 'em
83 f"{(x:=10)}"
84
85
86 def a():
87     return (x := 3)
88     await (b := 1)
89     yield (a := 2)
90     raise (c := 3)