]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/black/tests/data/cases/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:

Merge commit '882d8795c6ff65c02f2657e596391748d1b6b7f5'
[etc/vim.git] / .vim / bundle / black / tests / data / cases / pep_572_remove_parens.py
1 # flags: --minimum-version=3.8
2 if (foo := 0):
3     pass
4
5 if (foo := 1):
6     pass
7
8 if (y := 5 + 5):
9     pass
10
11 y = (x := 0)
12
13 y += (x := 0)
14
15 (y := 5 + 5)
16
17 test: int = (test2 := 2)
18
19 a, b = (test := (1, 2))
20
21 # see also https://github.com/psf/black/issues/2139
22 assert (foo := 42 - 12)
23
24 foo(x=(y := f(x)))
25
26
27 def foo(answer=(p := 42)):
28     ...
29
30
31 def foo2(answer: (p := 42) = 5):
32     ...
33
34
35 lambda: (x := 1)
36
37 a[(x := 12)]
38 a[:(x := 13)]
39
40 # we don't touch expressions in f-strings but if we do one day, don't break 'em
41 f'{(x:=10)}'
42
43
44 def a():
45     return (x := 3)
46     await (b := 1)
47     yield (a := 2)
48     raise (c := 3)
49
50 def this_is_so_dumb() -> (please := no):
51     pass
52
53 async def await_the_walrus():
54     with (x := y):
55         pass
56
57     with (x := y) as z, (a := b) as c:
58         pass
59
60     with (x := await y):
61         pass
62
63     with (x := await a, y := await b):
64         pass
65
66     with ((x := await a, y := await b)):
67         pass
68
69     with (x := await a), (y := await b):
70         pass
71
72
73 # output
74 if foo := 0:
75     pass
76
77 if foo := 1:
78     pass
79
80 if y := 5 + 5:
81     pass
82
83 y = (x := 0)
84
85 y += (x := 0)
86
87 (y := 5 + 5)
88
89 test: int = (test2 := 2)
90
91 a, b = (test := (1, 2))
92
93 # see also https://github.com/psf/black/issues/2139
94 assert (foo := 42 - 12)
95
96 foo(x=(y := f(x)))
97
98
99 def foo(answer=(p := 42)):
100     ...
101
102
103 def foo2(answer: (p := 42) = 5):
104     ...
105
106
107 lambda: (x := 1)
108
109 a[(x := 12)]
110 a[:(x := 13)]
111
112 # we don't touch expressions in f-strings but if we do one day, don't break 'em
113 f"{(x:=10)}"
114
115
116 def a():
117     return (x := 3)
118     await (b := 1)
119     yield (a := 2)
120     raise (c := 3)
121
122
123 def this_is_so_dumb() -> (please := no):
124     pass
125
126
127 async def await_the_walrus():
128     with (x := y):
129         pass
130
131     with (x := y) as z, (a := b) as c:
132         pass
133
134     with (x := await y):
135         pass
136
137     with (x := await a, y := await b):
138         pass
139
140     with (x := await a, y := await b):
141         pass
142
143     with (x := await a), (y := await b):
144         pass