@@ -2312,14 +2312,14 @@ def foo() -> None:
2312
2312
_ = 0
2313
2313
_ = ''
2314
2314
2315
- [case testUnusedTargetGlobal ]
2315
+ [case testUnusedTargetNotGlobal ]
2316
2316
_ = 0
2317
- _ = ''
2317
+ _ = '' # E: Incompatible types in assignment (expression has type "str", variable has type "int")
2318
2318
2319
- [case testUnusedTargetClass ]
2319
+ [case testUnusedTargetNotClass ]
2320
2320
class C:
2321
2321
_ = 0
2322
- _ = ''
2322
+ _ = '' # E: Incompatible types in assignment (expression has type "str", variable has type "int")
2323
2323
2324
2324
[case testUnusedTargetTupleUnpacking]
2325
2325
def foo() -> None:
@@ -2369,14 +2369,16 @@ _ = 0 # E: Incompatible types in assignment (expression has type "int", variabl
2369
2369
[builtins fixtures/module.pyi]
2370
2370
2371
2371
[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"
2375
2376
2376
2377
[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")
2380
2382
2381
2383
[case testUnusedTargetForLoop]
2382
2384
def f() -> None:
@@ -2397,10 +2399,12 @@ def f() -> None:
2397
2399
_ = 0
2398
2400
_ = ''
2399
2401
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.
2401
2405
def f() -> None:
2402
2406
try: pass
2403
2407
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")
2406
2410
[builtins fixtures/exception.pyi]
0 commit comments