2
2
-- ---------------------------------------
3
3
4
4
[case testAsyncDefPass]
5
- # options: fast_parser
5
+ # flags: --fast-parser
6
6
async def f() -> int:
7
7
pass
8
8
[builtins fixtures/async_await.pyi]
9
9
10
10
[case testAsyncDefReturn]
11
- # options: fast_parser
11
+ # flags: --fast-parser
12
12
async def f() -> int:
13
13
return 0
14
14
reveal_type(f()) # E: Revealed type is 'typing.Awaitable[builtins.int]'
15
15
[builtins fixtures/async_await.pyi]
16
16
17
17
[case testAwaitCoroutine]
18
- # options: fast_parser
18
+ # flags: --fast-parser
19
19
async def f() -> int:
20
20
x = await f()
21
21
reveal_type(x) # E: Revealed type is 'builtins.int*'
@@ -25,7 +25,7 @@ async def f() -> int:
25
25
main: note: In function "f":
26
26
27
27
[case testAwaitDefaultContext]
28
- # options: fast_parser
28
+ # flags: --fast-parser
29
29
from typing import TypeVar
30
30
T = TypeVar('T')
31
31
async def f(x: T) -> T:
@@ -37,7 +37,7 @@ main: note: In function "f":
37
37
main:6: error: Revealed type is 'T`-1'
38
38
39
39
[case testAwaitAnyContext]
40
- # options: fast_parser
40
+ # flags: --fast-parser
41
41
from typing import Any, TypeVar
42
42
T = TypeVar('T')
43
43
async def f(x: T) -> T:
@@ -49,7 +49,7 @@ main: note: In function "f":
49
49
main:6: error: Revealed type is 'Any'
50
50
51
51
[case testAwaitExplicitContext]
52
- # options: fast_parser
52
+ # flags: --fast-parser
53
53
from typing import TypeVar
54
54
T = TypeVar('T')
55
55
async def f(x: T) -> T:
@@ -61,7 +61,7 @@ main:5: error: Argument 1 to "f" has incompatible type "T"; expected "int"
61
61
main:6: error: Revealed type is 'builtins.int'
62
62
63
63
[case testAwaitGeneratorError]
64
- # options: fast_parser
64
+ # flags: --fast-parser
65
65
from typing import Any, Generator
66
66
def g() -> Generator[int, None, str]:
67
67
yield 0
@@ -74,7 +74,7 @@ main: note: In function "f":
74
74
main:7: error: Incompatible types in await (actual type Generator[int, None, str], expected type "Awaitable")
75
75
76
76
[case testAwaitIteratorError]
77
- # options: fast_parser
77
+ # flags: --fast-parser
78
78
from typing import Any, Iterator
79
79
def g() -> Iterator[Any]:
80
80
yield
@@ -86,7 +86,7 @@ main: note: In function "f":
86
86
main:6: error: Incompatible types in await (actual type Iterator[Any], expected type "Awaitable")
87
87
88
88
[case testAwaitArgumentError]
89
- # options: fast_parser
89
+ # flags: --fast-parser
90
90
def g() -> int:
91
91
return 0
92
92
async def f() -> int:
@@ -98,7 +98,7 @@ main: note: In function "f":
98
98
main:5: error: Incompatible types in await (actual type "int", expected type "Awaitable")
99
99
100
100
[case testAwaitResultError]
101
- # options: fast_parser
101
+ # flags: --fast-parser
102
102
async def g() -> int:
103
103
return 0
104
104
async def f() -> str:
@@ -109,7 +109,7 @@ main: note: In function "f":
109
109
main:5: error: Incompatible types in assignment (expression has type "int", variable has type "str")
110
110
111
111
[case testAwaitReturnError]
112
- # options: fast_parser
112
+ # flags: --fast-parser
113
113
async def g() -> int:
114
114
return 0
115
115
async def f() -> str:
@@ -121,7 +121,7 @@ main: note: In function "f":
121
121
main:6: error: Incompatible return value type (got "int", expected "str")
122
122
123
123
[case testAsyncFor]
124
- # options: fast_parser
124
+ # flags: --fast-parser
125
125
from typing import AsyncIterator
126
126
class C(AsyncIterator[int]):
127
127
async def __anext__(self) -> int: return 0
@@ -133,7 +133,7 @@ async def f() -> None:
133
133
main: note: In function "f":
134
134
135
135
[case testAsyncForError]
136
- # options: fast_parser
136
+ # flags: --fast-parser
137
137
from typing import AsyncIterator
138
138
async def f() -> None:
139
139
async for x in [1]:
@@ -145,7 +145,7 @@ main:4: error: AsyncIterable expected
145
145
main:4: error: List[int] has no attribute "__aiter__"
146
146
147
147
[case testAsyncWith]
148
- # options: fast_parser
148
+ # flags: --fast-parser
149
149
class C:
150
150
async def __aenter__(self) -> int: pass
151
151
async def __aexit__(self, x, y, z) -> None: pass
@@ -157,7 +157,7 @@ async def f() -> None:
157
157
main: note: In function "f":
158
158
159
159
[case testAsyncWithError]
160
- # options: fast_parser
160
+ # flags: --fast-parser
161
161
class C:
162
162
def __enter__(self) -> int: pass
163
163
def __exit__(self, x, y, z) -> None: pass
@@ -171,7 +171,7 @@ main:6: error: "C" has no attribute "__aenter__"; maybe "__enter__"?
171
171
main:6: error: "C" has no attribute "__aexit__"; maybe "__exit__"?
172
172
173
173
[case testAsyncWithErrorBadAenter]
174
- # options: fast_parser
174
+ # flags: --fast-parser
175
175
class C:
176
176
def __aenter__(self) -> int: pass
177
177
async def __aexit__(self, x, y, z) -> None: pass
@@ -183,7 +183,7 @@ async def f() -> None:
183
183
main: note: In function "f":
184
184
185
185
[case testAsyncWithErrorBadAenter2]
186
- # options: fast_parser
186
+ # flags: --fast-parser
187
187
class C:
188
188
def __aenter__(self) -> None: pass
189
189
async def __aexit__(self, x, y, z) -> None: pass
@@ -195,7 +195,7 @@ async def f() -> None:
195
195
main: note: In function "f":
196
196
197
197
[case testAsyncWithErrorBadAexit]
198
- # options: fast_parser
198
+ # flags: --fast-parser
199
199
class C:
200
200
async def __aenter__(self) -> int: pass
201
201
def __aexit__(self, x, y, z) -> int: pass
@@ -207,7 +207,7 @@ async def f() -> None:
207
207
main: note: In function "f":
208
208
209
209
[case testAsyncWithErrorBadAexit2]
210
- # options: fast_parser
210
+ # flags: --fast-parser
211
211
class C:
212
212
async def __aenter__(self) -> int: pass
213
213
def __aexit__(self, x, y, z) -> None: pass
@@ -219,7 +219,7 @@ async def f() -> None:
219
219
main: note: In function "f":
220
220
221
221
[case testNoYieldInAsyncDef]
222
- # options: fast_parser
222
+ # flags: --fast-parser
223
223
async def f():
224
224
yield None
225
225
async def g():
@@ -236,7 +236,7 @@ main: note: In function "h":
236
236
main:7: error: 'yield' in async function
237
237
238
238
[case testNoYieldFromInAsyncDef]
239
- # options: fast_parser
239
+ # flags: --fast-parser
240
240
async def f():
241
241
yield from []
242
242
async def g():
@@ -249,12 +249,12 @@ main: note: In function "g":
249
249
main:5: error: 'yield from' in async function
250
250
251
251
[case testNoAsyncDefInPY2_python2]
252
- # options: fast_parser
252
+ # flags: --fast-parser
253
253
async def f(): # E: invalid syntax
254
254
pass
255
255
256
256
[case testYieldFromNoAwaitable]
257
- # options: fast_parser
257
+ # flags: --fast-parser
258
258
from typing import Any, Generator
259
259
async def f() -> str:
260
260
return ''
@@ -267,7 +267,7 @@ main: note: In function "g":
267
267
main:6: error: "yield from" can't be applied to Awaitable[str]
268
268
269
269
[case testAwaitableSubclass]
270
- # options: fast_parser
270
+ # flags: --fast-parser
271
271
from typing import Any, AsyncIterator, Awaitable, Generator
272
272
class A(Awaitable[int]):
273
273
def __await__(self) -> Generator[Any, None, int]:
@@ -295,7 +295,7 @@ async def main() -> None:
295
295
main: note: In function "main":
296
296
297
297
[case testYieldTypeCheckInDecoratedCoroutine]
298
- # options: fast_parser
298
+ # flags: --fast-parser
299
299
from typing import Generator
300
300
from types import coroutine
301
301
@coroutine
@@ -316,7 +316,7 @@ main: note: In function "f":
316
316
-- ------------------------------------------
317
317
318
318
[case testFullCoroutineMatrix]
319
- # options: fast_parser suppress_error_context
319
+ # flags: --fast-parser --suppress-error-context
320
320
from typing import Any, AsyncIterator, Awaitable, Generator, Iterator
321
321
from types import coroutine
322
322
0 commit comments