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

Remove hard coded test cases (#3062)
[etc/vim.git] / tests / data / preview / remove_await_parens.py
1 import asyncio
2
3 # Control example
4 async def main():
5     await asyncio.sleep(1)
6
7 # Remove brackets for short coroutine/task
8 async def main():
9     await (asyncio.sleep(1))
10
11 async def main():
12     await (
13         asyncio.sleep(1)
14     )
15
16 async def main():
17     await (asyncio.sleep(1)
18     )
19
20 # Check comments
21 async def main():
22     await (  # Hello
23         asyncio.sleep(1)
24     )
25
26 async def main():
27     await (
28         asyncio.sleep(1)  # Hello
29     )
30
31 async def main():
32     await (
33         asyncio.sleep(1)
34     )  # Hello
35
36 # Long lines
37 async def main():
38     await asyncio.gather(asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1))
39
40 # Same as above but with magic trailing comma in function
41 async def main():
42     await asyncio.gather(asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1), asyncio.sleep(1),)
43
44 # Cr@zY Br@ck3Tz
45 async def main():
46     await (
47         (((((((((((((
48         (((        (((
49         (((         (((
50         (((         (((
51         (((        (((
52         ((black(1)))
53         )))        )))
54         )))         )))
55         )))         )))
56         )))        )))
57         )))))))))))))
58     )
59
60 # Keep brackets around non power operations and nested awaits
61 async def main():
62     await (set_of_tasks | other_set)
63
64 async def main():
65     await (await asyncio.sleep(1))
66
67 # It's awaits all the way down...
68 async def main():
69     await (await x)
70
71 async def main():
72     await (yield x)
73
74 async def main():
75     await (await (asyncio.sleep(1)))
76
77 async def main():
78     await (await (await (await (await (asyncio.sleep(1))))))
79
80 # output
81 import asyncio
82
83 # Control example
84 async def main():
85     await asyncio.sleep(1)
86
87
88 # Remove brackets for short coroutine/task
89 async def main():
90     await asyncio.sleep(1)
91
92
93 async def main():
94     await asyncio.sleep(1)
95
96
97 async def main():
98     await asyncio.sleep(1)
99
100
101 # Check comments
102 async def main():
103     await asyncio.sleep(1)  # Hello
104
105
106 async def main():
107     await asyncio.sleep(1)  # Hello
108
109
110 async def main():
111     await asyncio.sleep(1)  # Hello
112
113
114 # Long lines
115 async def main():
116     await asyncio.gather(
117         asyncio.sleep(1),
118         asyncio.sleep(1),
119         asyncio.sleep(1),
120         asyncio.sleep(1),
121         asyncio.sleep(1),
122         asyncio.sleep(1),
123         asyncio.sleep(1),
124     )
125
126
127 # Same as above but with magic trailing comma in function
128 async def main():
129     await asyncio.gather(
130         asyncio.sleep(1),
131         asyncio.sleep(1),
132         asyncio.sleep(1),
133         asyncio.sleep(1),
134         asyncio.sleep(1),
135         asyncio.sleep(1),
136         asyncio.sleep(1),
137     )
138
139
140 # Cr@zY Br@ck3Tz
141 async def main():
142     await black(1)
143
144
145 # Keep brackets around non power operations and nested awaits
146 async def main():
147     await (set_of_tasks | other_set)
148
149
150 async def main():
151     await (await asyncio.sleep(1))
152
153
154 # It's awaits all the way down...
155 async def main():
156     await (await x)
157
158
159 async def main():
160     await (yield x)
161
162
163 async def main():
164     await (await asyncio.sleep(1))
165
166
167 async def main():
168     await (await (await (await (await asyncio.sleep(1)))))