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

8509ecdb92c0afd94d92d7d65393ad7332d2e978
[etc/vim.git] / tests / data / simple_cases / return_annotation_brackets.py
1 # Control
2 def double(a: int) -> int:
3     return 2*a
4
5 # Remove the brackets
6 def double(a: int) -> (int):
7     return 2*a
8
9 # Some newline variations
10 def double(a: int) -> (
11     int):
12     return 2*a
13
14 def double(a: int) -> (int
15 ):
16     return 2*a
17
18 def double(a: int) -> (
19     int
20 ):
21     return 2*a
22
23 # Don't lose the comments
24 def double(a: int) -> ( # Hello
25     int
26 ):
27     return 2*a
28
29 def double(a: int) -> (
30     int # Hello
31 ):
32     return 2*a
33
34 # Really long annotations
35 def foo() -> (
36     intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds
37 ):
38     return 2
39
40 def foo() -> intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds:
41     return 2
42
43 def foo() -> intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds | intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds:
44     return 2
45
46 def foo(a: int, b: int, c: int,) -> intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds:
47     return 2
48
49 def foo(a: int, b: int, c: int,) -> intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds | intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds:
50     return 2
51
52 # Split args but no need to split return
53 def foo(a: int, b: int, c: int,) -> int:
54     return 2
55
56 # Deeply nested brackets
57 # with *interesting* spacing
58 def double(a: int) -> (((((int))))):
59     return 2*a
60
61 def double(a: int) -> (
62     (  (
63         ((int)
64          )
65            )
66             )
67         ):
68     return 2*a
69
70 def foo() -> (
71     (  (
72     intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds
73 )
74 )):
75     return 2
76
77 # Return type with commas
78 def foo() -> (
79     tuple[int, int, int]
80 ):
81     return 2
82
83 def foo() -> tuple[loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong, loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong]:
84     return 2
85
86 # Magic trailing comma example
87 def foo() -> tuple[int, int, int,]:
88     return 2
89
90 # Magic trailing comma example, with params
91 # this is broken - the trailing comma is transferred to the param list. Fixed in preview
92 def foo(a,b) -> tuple[int, int, int,]:
93     return 2
94
95 # output
96 # Control
97 def double(a: int) -> int:
98     return 2 * a
99
100
101 # Remove the brackets
102 def double(a: int) -> int:
103     return 2 * a
104
105
106 # Some newline variations
107 def double(a: int) -> int:
108     return 2 * a
109
110
111 def double(a: int) -> int:
112     return 2 * a
113
114
115 def double(a: int) -> int:
116     return 2 * a
117
118
119 # Don't lose the comments
120 def double(a: int) -> int:  # Hello
121     return 2 * a
122
123
124 def double(a: int) -> int:  # Hello
125     return 2 * a
126
127
128 # Really long annotations
129 def foo() -> (
130     intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds
131 ):
132     return 2
133
134
135 def foo() -> (
136     intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds
137 ):
138     return 2
139
140
141 def foo() -> (
142     intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds
143     | intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds
144 ):
145     return 2
146
147
148 def foo(
149     a: int,
150     b: int,
151     c: int,
152 ) -> intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds:
153     return 2
154
155
156 def foo(
157     a: int,
158     b: int,
159     c: int,
160 ) -> (
161     intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds
162     | intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds
163 ):
164     return 2
165
166
167 # Split args but no need to split return
168 def foo(
169     a: int,
170     b: int,
171     c: int,
172 ) -> int:
173     return 2
174
175
176 # Deeply nested brackets
177 # with *interesting* spacing
178 def double(a: int) -> int:
179     return 2 * a
180
181
182 def double(a: int) -> int:
183     return 2 * a
184
185
186 def foo() -> (
187     intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds
188 ):
189     return 2
190
191
192 # Return type with commas
193 def foo() -> tuple[int, int, int]:
194     return 2
195
196
197 def foo() -> (
198     tuple[
199         loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong,
200         loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong,
201         loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong,
202     ]
203 ):
204     return 2
205
206
207 # Magic trailing comma example
208 def foo() -> (
209     tuple[
210         int,
211         int,
212         int,
213     ]
214 ):
215     return 2
216
217
218 # Magic trailing comma example, with params
219 # this is broken - the trailing comma is transferred to the param list. Fixed in preview
220 def foo(
221     a, b
222 ) -> tuple[int, int, int,]:
223     return 2