Skip to content

Commit 67d84aa

Browse files
author
Guido van Rossum
committed
Really fix and add tests
1 parent 93a1874 commit 67d84aa

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test-data/unit/check-inference.test

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2307,10 +2307,17 @@ class C:
23072307
-- Special case for assignment to '_'
23082308
-- ----------------------------------
23092309

2310-
[case testUnusedTargetSingle]
2310+
[case testUnusedTargetLocal]
23112311
def foo() -> None:
23122312
_ = 0
23132313
_ = ''
2314+
2315+
[case testUnusedTargetGlobal]
2316+
_ = 0
2317+
_ = ''
2318+
2319+
[case testUnusedTargetClass]
2320+
class C:
23142321
_ = 0
23152322
_ = ''
23162323

@@ -2369,7 +2376,7 @@ _().method() # E: "_" has no attribute "method"
23692376
[case testUnusedTargetNotDef]
23702377
def _() -> int:
23712378
pass
2372-
_() + 0
2379+
_() + '' # E: Unsupported operand types for + ("int" and "str")
23732380

23742381
[case testUnusedTargetForLoop]
23752382
def f() -> None:

0 commit comments

Comments
 (0)