Skip to content

Commit 9da4fb6

Browse files
authored
Fix several tests on Python 3.11 (#13259)
As a result of python/cpython#94948 we started to fail these tests on Python 3.11b5
1 parent fcf8f0b commit 9da4fb6

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

test-data/unit/check-python38.test

+11-5
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ h(arg=0) # E: Unexpected keyword argument "arg" for "h"
210210
i(arg=0) # E: Unexpected keyword argument "arg"
211211

212212
[case testWalrus]
213-
# flags: --strict-optional
213+
# flags: --strict-optional --python-version 3.8
214214
from typing import NamedTuple, Optional, List
215215
from typing_extensions import Final
216216

@@ -385,6 +385,7 @@ reveal_type(z2) # E: Name "z2" is not defined # N: Revealed type is "Any"
385385
[builtins fixtures/isinstancelist.pyi]
386386

387387
[case testWalrusConditionalTypeBinder]
388+
# flags: --python-version 3.8
388389
from typing import Union
389390
from typing_extensions import Literal
390391

@@ -405,7 +406,7 @@ else:
405406
[builtins fixtures/property.pyi]
406407

407408
[case testWalrusConditionalTypeCheck]
408-
# flags: --strict-optional
409+
# flags: --strict-optional --python-version 3.8
409410
from typing import Optional
410411

411412
maybe_str: Optional[str]
@@ -421,6 +422,7 @@ reveal_type(maybe_str) # N: Revealed type is "Union[builtins.str, None]"
421422
[builtins fixtures/bool.pyi]
422423

423424
[case testWalrusConditionalTypeCheck2]
425+
# flags: --python-version 3.8
424426
from typing import Optional
425427

426428
maybe_str: Optional[str]
@@ -436,6 +438,7 @@ reveal_type(maybe_str) # N: Revealed type is "Union[builtins.str, None]"
436438
[builtins fixtures/bool.pyi]
437439

438440
[case testWalrusPartialTypes]
441+
# flags: --python-version 3.8
439442
from typing import List
440443

441444
def check_partial_list() -> None:
@@ -452,7 +455,7 @@ def check_partial_list() -> None:
452455
[builtins fixtures/list.pyi]
453456

454457
[case testWalrusAssignmentAndConditionScopeForLiteral]
455-
# flags: --warn-unreachable
458+
# flags: --warn-unreachable --python-version 3.8
456459

457460
if (x := 0):
458461
reveal_type(x) # E: Statement is unreachable
@@ -462,7 +465,7 @@ else:
462465
reveal_type(x) # N: Revealed type is "builtins.int"
463466

464467
[case testWalrusAssignmentAndConditionScopeForProperty]
465-
# flags: --warn-unreachable
468+
# flags: --warn-unreachable --python-version 3.8
466469

467470
from typing_extensions import Literal
468471

@@ -490,7 +493,7 @@ reveal_type(y) # N: Revealed type is "Literal[False]"
490493
[builtins fixtures/property.pyi]
491494

492495
[case testWalrusAssignmentAndConditionScopeForFunction]
493-
# flags: --warn-unreachable
496+
# flags: --warn-unreachable --python-version 3.8
494497

495498
from typing_extensions import Literal
496499

@@ -523,6 +526,7 @@ reveal_type(z) # N: Revealed type is "Literal[False]"
523526
[builtins fixtures/tuple.pyi]
524527

525528
[case testWalrusExpr]
529+
# flags: --python-version 3.8
526530
def func() -> None:
527531
foo = Foo()
528532
if x := foo.x:
@@ -533,6 +537,7 @@ class Foo:
533537
self.x = 123
534538

535539
[case testWalrusTypeGuard]
540+
# flags: --python-version 3.8
536541
from typing_extensions import TypeGuard
537542
def is_float(a: object) -> TypeGuard[float]: pass
538543
def main(a: object) -> None:
@@ -542,6 +547,7 @@ def main(a: object) -> None:
542547
[builtins fixtures/tuple.pyi]
543548

544549
[case testWalrusRedefined]
550+
# flags: --python-version 3.8
545551
def foo() -> None:
546552
x = 0
547553
[x := x + y for y in [1, 2, 3]]

0 commit comments

Comments
 (0)