@@ -210,7 +210,7 @@ h(arg=0) # E: Unexpected keyword argument "arg" for "h"
210
210
i(arg=0) # E: Unexpected keyword argument "arg"
211
211
212
212
[case testWalrus]
213
- # flags: --strict-optional
213
+ # flags: --strict-optional --python-version 3.8
214
214
from typing import NamedTuple, Optional, List
215
215
from typing_extensions import Final
216
216
@@ -385,6 +385,7 @@ reveal_type(z2) # E: Name "z2" is not defined # N: Revealed type is "Any"
385
385
[builtins fixtures/isinstancelist.pyi]
386
386
387
387
[case testWalrusConditionalTypeBinder]
388
+ # flags: --python-version 3.8
388
389
from typing import Union
389
390
from typing_extensions import Literal
390
391
@@ -405,7 +406,7 @@ else:
405
406
[builtins fixtures/property.pyi]
406
407
407
408
[case testWalrusConditionalTypeCheck]
408
- # flags: --strict-optional
409
+ # flags: --strict-optional --python-version 3.8
409
410
from typing import Optional
410
411
411
412
maybe_str: Optional[str]
@@ -421,6 +422,7 @@ reveal_type(maybe_str) # N: Revealed type is "Union[builtins.str, None]"
421
422
[builtins fixtures/bool.pyi]
422
423
423
424
[case testWalrusConditionalTypeCheck2]
425
+ # flags: --python-version 3.8
424
426
from typing import Optional
425
427
426
428
maybe_str: Optional[str]
@@ -436,6 +438,7 @@ reveal_type(maybe_str) # N: Revealed type is "Union[builtins.str, None]"
436
438
[builtins fixtures/bool.pyi]
437
439
438
440
[case testWalrusPartialTypes]
441
+ # flags: --python-version 3.8
439
442
from typing import List
440
443
441
444
def check_partial_list() -> None:
@@ -452,7 +455,7 @@ def check_partial_list() -> None:
452
455
[builtins fixtures/list.pyi]
453
456
454
457
[case testWalrusAssignmentAndConditionScopeForLiteral]
455
- # flags: --warn-unreachable
458
+ # flags: --warn-unreachable --python-version 3.8
456
459
457
460
if (x := 0):
458
461
reveal_type(x) # E: Statement is unreachable
@@ -462,7 +465,7 @@ else:
462
465
reveal_type(x) # N: Revealed type is "builtins.int"
463
466
464
467
[case testWalrusAssignmentAndConditionScopeForProperty]
465
- # flags: --warn-unreachable
468
+ # flags: --warn-unreachable --python-version 3.8
466
469
467
470
from typing_extensions import Literal
468
471
@@ -490,7 +493,7 @@ reveal_type(y) # N: Revealed type is "Literal[False]"
490
493
[builtins fixtures/property.pyi]
491
494
492
495
[case testWalrusAssignmentAndConditionScopeForFunction]
493
- # flags: --warn-unreachable
496
+ # flags: --warn-unreachable --python-version 3.8
494
497
495
498
from typing_extensions import Literal
496
499
@@ -523,6 +526,7 @@ reveal_type(z) # N: Revealed type is "Literal[False]"
523
526
[builtins fixtures/tuple.pyi]
524
527
525
528
[case testWalrusExpr]
529
+ # flags: --python-version 3.8
526
530
def func() -> None:
527
531
foo = Foo()
528
532
if x := foo.x:
@@ -533,6 +537,7 @@ class Foo:
533
537
self.x = 123
534
538
535
539
[case testWalrusTypeGuard]
540
+ # flags: --python-version 3.8
536
541
from typing_extensions import TypeGuard
537
542
def is_float(a: object) -> TypeGuard[float]: pass
538
543
def main(a: object) -> None:
@@ -542,6 +547,7 @@ def main(a: object) -> None:
542
547
[builtins fixtures/tuple.pyi]
543
548
544
549
[case testWalrusRedefined]
550
+ # flags: --python-version 3.8
545
551
def foo() -> None:
546
552
x = 0
547
553
[x := x + y for y in [1, 2, 3]]
0 commit comments