[ty] Use range instead of custom IntIterable (#21138)
## Summary We previously didn't understand `range` and wrote these custom `IntIterable`/`IntIterator` classes for tests. We can now remove them and make the tests shorter in some places.
This commit is contained in:
@@ -1,14 +1,6 @@
|
||||
# Comprehensions with invalid syntax
|
||||
|
||||
```py
|
||||
class IntIterator:
|
||||
def __next__(self) -> int:
|
||||
return 42
|
||||
|
||||
class IntIterable:
|
||||
def __iter__(self) -> IntIterator:
|
||||
return IntIterator()
|
||||
|
||||
# Missing 'in' keyword.
|
||||
|
||||
# It's reasonably clear here what they *meant* to write,
|
||||
@@ -16,7 +8,7 @@ class IntIterable:
|
||||
|
||||
# error: [invalid-syntax] "Expected 'in', found name"
|
||||
# revealed: int
|
||||
[reveal_type(a) for a IntIterable()]
|
||||
[reveal_type(a) for a range(3)]
|
||||
|
||||
|
||||
# Missing iteration variable
|
||||
@@ -25,7 +17,7 @@ class IntIterable:
|
||||
# error: [invalid-syntax] "Expected 'in', found name"
|
||||
# error: [unresolved-reference]
|
||||
# revealed: Unknown
|
||||
[reveal_type(b) for in IntIterable()]
|
||||
[reveal_type(b) for in range(3)]
|
||||
|
||||
|
||||
# Missing iterable
|
||||
|
||||
Reference in New Issue
Block a user