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

Draft for Black 2023 stable style (#3418)
[etc/vim.git] / tests / data / py_38 / 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 a[(x := 12)]
37 a[:(x := 13)]
38
39 # we don't touch expressions in f-strings but if we do one day, don't break 'em
40 f'{(x:=10)}'
41
42
43 def a():
44     return (x := 3)
45     await (b := 1)
46     yield (a := 2)
47     raise (c := 3)
48
49 def this_is_so_dumb() -> (please := no):
50     pass
51
52 async def await_the_walrus():
53     with (x := y):
54         pass
55
56     with (x := y) as z, (a := b) as c:
57         pass
58
59     with (x := await y):
60         pass
61
62     with (x := await a, y := await b):
63         pass
64
65     with ((x := await a, y := await b)):
66         pass
67
68     with (x := await a), (y := await b):
69         pass
70
71
72 # output
73 if foo := 0:
74     pass
75
76 if foo := 1:
77     pass
78
79 if y := 5 + 5:
80     pass
81
82 y = (x := 0)
83
84 y += (x := 0)
85
86 (y := 5 + 5)
87
88 test: int = (test2 := 2)
89
90 a, b = (test := (1, 2))
91
92 # see also https://github.com/psf/black/issues/2139
93 assert (foo := 42 - 12)
94
95 foo(x=(y := f(x)))
96
97
98 def foo(answer=(p := 42)):
99     ...
100
101
102 def foo2(answer: (p := 42) = 5):
103     ...
104
105
106 lambda: (x := 1)
107
108 a[(x := 12)]
109 a[:(x := 13)]
110
111 # we don't touch expressions in f-strings but if we do one day, don't break 'em
112 f"{(x:=10)}"
113
114
115 def a():
116     return (x := 3)
117     await (b := 1)
118     yield (a := 2)
119     raise (c := 3)
120
121
122 def this_is_so_dumb() -> (please := no):
123     pass
124
125
126 async def await_the_walrus():
127     with (x := y):
128         pass
129
130     with (x := y) as z, (a := b) as c:
131         pass
132
133     with (x := await y):
134         pass
135
136     with (x := await a, y := await b):
137         pass
138
139     with (x := await a, y := await b):
140         pass
141
142     with (x := await a), (y := await b):
143         pass