Skip to content

Commit 9b00e73

Browse files
author
Guido van Rossum
committed
Adjust tests for the new world
1 parent 921110c commit 9b00e73

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

test-data/unit/check-inference.test

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2312,14 +2312,14 @@ def foo() -> None:
23122312
_ = 0
23132313
_ = ''
23142314

2315-
[case testUnusedTargetGlobal]
2315+
[case testUnusedTargetNotGlobal]
23162316
_ = 0
2317-
_ = ''
2317+
_ = '' # E: Incompatible types in assignment (expression has type "str", variable has type "int")
23182318

2319-
[case testUnusedTargetClass]
2319+
[case testUnusedTargetNotClass]
23202320
class C:
23212321
_ = 0
2322-
_ = ''
2322+
_ = '' # E: Incompatible types in assignment (expression has type "str", variable has type "int")
23232323

23242324
[case testUnusedTargetTupleUnpacking]
23252325
def foo() -> None:
@@ -2369,14 +2369,16 @@ _ = 0 # E: Incompatible types in assignment (expression has type "int", variabl
23692369
[builtins fixtures/module.pyi]
23702370

23712371
[case testUnusedTargetNotClass]
2372-
class _:
2373-
pass
2374-
_().method() # E: "_" has no attribute "method"
2372+
def foo() -> None:
2373+
class _:
2374+
pass
2375+
_().method() # E: "_" has no attribute "method"
23752376

23762377
[case testUnusedTargetNotDef]
2377-
def _() -> int:
2378-
pass
2379-
_() + '' # E: Unsupported operand types for + ("int" and "str")
2378+
def foo() -> None:
2379+
def _() -> int:
2380+
pass
2381+
_() + '' # E: Unsupported operand types for + ("int" and "str")
23802382

23812383
[case testUnusedTargetForLoop]
23822384
def f() -> None:
@@ -2397,10 +2399,12 @@ def f() -> None:
23972399
_ = 0
23982400
_ = ''
23992401

2400-
[case testUnusedTargetExceptClause]
2402+
[case testUnusedTargetNotExceptClause]
2403+
# Things don't work for except clauses.
2404+
# This is due to the implementation, but it's just as well.
24012405
def f() -> None:
24022406
try: pass
24032407
except BaseException as _:
2404-
_ = 0
2405-
_ = ''
2408+
_ = 0 # E: Incompatible types in assignment (expression has type "int", variable has type "BaseException")
2409+
_ = '' # E: Incompatible types in assignment (expression has type "str", variable has type "BaseException")
24062410
[builtins fixtures/exception.pyi]

0 commit comments

Comments
 (0)