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

Fix strtobool function (#3025)
[etc/vim.git] / tests / data / 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 # Long string example
91 def frobnicate() -> "ThisIsTrulyUnreasonablyExtremelyLongClassName | list[ThisIsTrulyUnreasonablyExtremelyLongClassName]":
92     pass
93
94 # output
95 # Control
96 def double(a: int) -> int:
97     return 2 * a
98
99
100 # Remove the brackets
101 def double(a: int) -> int:
102     return 2 * a
103
104
105 # Some newline variations
106 def double(a: int) -> int:
107     return 2 * a
108
109
110 def double(a: int) -> int:
111     return 2 * a
112
113
114 def double(a: int) -> int:
115     return 2 * a
116
117
118 # Don't lose the comments
119 def double(a: int) -> int:  # Hello
120     return 2 * a
121
122
123 def double(a: int) -> int:  # Hello
124     return 2 * a
125
126
127 # Really long annotations
128 def foo() -> (
129     intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds
130 ):
131     return 2
132
133
134 def foo() -> (
135     intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds
136 ):
137     return 2
138
139
140 def foo() -> (
141     intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds
142     | intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds
143 ):
144     return 2
145
146
147 def foo(
148     a: int,
149     b: int,
150     c: int,
151 ) -> intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds:
152     return 2
153
154
155 def foo(
156     a: int,
157     b: int,
158     c: int,
159 ) -> (
160     intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds
161     | intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds
162 ):
163     return 2
164
165
166 # Split args but no need to split return
167 def foo(
168     a: int,
169     b: int,
170     c: int,
171 ) -> int:
172     return 2
173
174
175 # Deeply nested brackets
176 # with *interesting* spacing
177 def double(a: int) -> int:
178     return 2 * a
179
180
181 def double(a: int) -> int:
182     return 2 * a
183
184
185 def foo() -> (
186     intsdfsafafafdfdsasdfsfsdfasdfafdsafdfdsfasdskdsdsfdsafdsafsdfdasfffsfdsfdsafafhdskfhdsfjdslkfdlfsdkjhsdfjkdshfkljds
187 ):
188     return 2
189
190
191 # Return type with commas
192 def foo() -> tuple[int, int, int]:
193     return 2
194
195
196 def foo() -> (
197     tuple[
198         loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong,
199         loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong,
200         loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong,
201     ]
202 ):
203     return 2
204
205
206 # Magic trailing comma example
207 def foo() -> (
208     tuple[
209         int,
210         int,
211         int,
212     ]
213 ):
214     return 2
215
216
217 # Long string example
218 def frobnicate() -> (
219     "ThisIsTrulyUnreasonablyExtremelyLongClassName |"
220     " list[ThisIsTrulyUnreasonablyExtremelyLongClassName]"
221 ):
222     pass