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

Fix an f-string crash in ESP. (#3463)
[etc/vim.git] / tests / data / preview / comments9.py
1 # Test for https://github.com/psf/black/issues/246.
2
3 some = statement
4 # This comment should be split from the statement above by two lines.
5 def function():
6     pass
7
8
9 some = statement
10 # This multiline comments section
11 # should be split from the statement
12 # above by two lines.
13 def function():
14     pass
15
16
17 some = statement
18 # This comment should be split from the statement above by two lines.
19 async def async_function():
20     pass
21
22
23 some = statement
24 # This comment should be split from the statement above by two lines.
25 class MyClass:
26     pass
27
28
29 some = statement
30 # This should be stick to the statement above
31
32 # This should be split from the above by two lines
33 class MyClassWithComplexLeadingComments:
34     pass
35
36
37 class ClassWithDocstring:
38     """A docstring."""
39 # Leading comment after a class with just a docstring
40 class MyClassAfterAnotherClassWithDocstring:
41     pass
42
43
44 some = statement
45 # leading 1
46 @deco1
47 # leading 2
48 # leading 2 extra
49 @deco2(with_args=True)
50 # leading 3
51 @deco3
52 # leading 4
53 def decorated():
54     pass
55
56
57 some = statement
58 # leading 1
59 @deco1
60 # leading 2
61 @deco2(with_args=True)
62
63 # leading 3 that already has an empty line
64 @deco3
65 # leading 4
66 def decorated_with_split_leading_comments():
67     pass
68
69
70 some = statement
71 # leading 1
72 @deco1
73 # leading 2
74 @deco2(with_args=True)
75 # leading 3
76 @deco3
77
78 # leading 4 that already has an empty line
79 def decorated_with_split_leading_comments():
80     pass
81
82
83 def main():
84     if a:
85         # Leading comment before inline function
86         def inline():
87             pass
88         # Another leading comment
89         def another_inline():
90             pass
91     else:
92         # More leading comments
93         def inline_after_else():
94             pass
95
96
97 if a:
98     # Leading comment before "top-level inline" function
99     def top_level_quote_inline():
100         pass
101     # Another leading comment
102     def another_top_level_quote_inline_inline():
103         pass
104 else:
105     # More leading comments
106     def top_level_quote_inline_after_else():
107         pass
108
109
110 class MyClass:
111     # First method has no empty lines between bare class def.
112     # More comments.
113     def first_method(self):
114         pass
115
116
117 # output
118
119
120 # Test for https://github.com/psf/black/issues/246.
121
122 some = statement
123
124
125 # This comment should be split from the statement above by two lines.
126 def function():
127     pass
128
129
130 some = statement
131
132
133 # This multiline comments section
134 # should be split from the statement
135 # above by two lines.
136 def function():
137     pass
138
139
140 some = statement
141
142
143 # This comment should be split from the statement above by two lines.
144 async def async_function():
145     pass
146
147
148 some = statement
149
150
151 # This comment should be split from the statement above by two lines.
152 class MyClass:
153     pass
154
155
156 some = statement
157 # This should be stick to the statement above
158
159
160 # This should be split from the above by two lines
161 class MyClassWithComplexLeadingComments:
162     pass
163
164
165 class ClassWithDocstring:
166     """A docstring."""
167
168
169 # Leading comment after a class with just a docstring
170 class MyClassAfterAnotherClassWithDocstring:
171     pass
172
173
174 some = statement
175
176
177 # leading 1
178 @deco1
179 # leading 2
180 # leading 2 extra
181 @deco2(with_args=True)
182 # leading 3
183 @deco3
184 # leading 4
185 def decorated():
186     pass
187
188
189 some = statement
190
191
192 # leading 1
193 @deco1
194 # leading 2
195 @deco2(with_args=True)
196
197 # leading 3 that already has an empty line
198 @deco3
199 # leading 4
200 def decorated_with_split_leading_comments():
201     pass
202
203
204 some = statement
205
206
207 # leading 1
208 @deco1
209 # leading 2
210 @deco2(with_args=True)
211 # leading 3
212 @deco3
213
214 # leading 4 that already has an empty line
215 def decorated_with_split_leading_comments():
216     pass
217
218
219 def main():
220     if a:
221         # Leading comment before inline function
222         def inline():
223             pass
224
225         # Another leading comment
226         def another_inline():
227             pass
228
229     else:
230         # More leading comments
231         def inline_after_else():
232             pass
233
234
235 if a:
236     # Leading comment before "top-level inline" function
237     def top_level_quote_inline():
238         pass
239
240     # Another leading comment
241     def another_top_level_quote_inline_inline():
242         pass
243
244 else:
245     # More leading comments
246     def top_level_quote_inline_after_else():
247         pass
248
249
250 class MyClass:
251     # First method has no empty lines between bare class def.
252     # More comments.
253     def first_method(self):
254         pass