]> 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:

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