|
| 1 | +[case testItertoolsBatched312] |
| 2 | +# flags: --python-version 3.12 |
| 3 | + |
| 4 | +from itertools import batched |
| 5 | + |
| 6 | +b = batched([0], 1) |
| 7 | +reveal_type(b) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]" |
| 8 | +reveal_type(b.__next__()) # N: Revealed type is "builtins.tuple[builtins.int, ...]" |
| 9 | + |
| 10 | +reveal_type(batched([0, 0], 2)) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]" |
| 11 | +reveal_type(batched([0, 0, 0], 3)) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]" |
| 12 | +reveal_type(batched([0, 0, 0, 0], 4)) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]" |
| 13 | +reveal_type(batched([0, 0, 0, 0, 0], 5)) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]" |
| 14 | + |
| 15 | +reveal_type(batched([0], 2)) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]" |
| 16 | +reveal_type(batched([0], 2)) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]" |
| 17 | + |
| 18 | +def f() -> int: |
| 19 | + return 3 |
| 20 | + |
| 21 | +reveal_type(batched([0, 0, 0], f())) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]" |
| 22 | + |
| 23 | +[builtins fixtures/tuple.pyi] |
| 24 | + |
| 25 | +[case testItertoolsBatched313] |
| 26 | +# flags: --python-version 3.13 |
| 27 | + |
| 28 | +from itertools import batched |
| 29 | + |
| 30 | +b = batched([0], 1, strict=True) |
| 31 | +reveal_type(b) # N: Revealed type is "itertools.batched[tuple[builtins.int]]" |
| 32 | +reveal_type(b.__next__()) # N: Revealed type is "tuple[builtins.int]" |
| 33 | + |
| 34 | +reveal_type(batched([0, 0], 2, strict=True)) # N: Revealed type is "itertools.batched[tuple[builtins.int, builtins.int]]" |
| 35 | +reveal_type(batched([0, 0, 0], 3, strict=True)) # N: Revealed type is "itertools.batched[tuple[builtins.int, builtins.int, builtins.int]]" |
| 36 | +reveal_type(batched([0, 0, 0, 0], 4, strict=True)) # N: Revealed type is "itertools.batched[tuple[builtins.int, builtins.int, builtins.int, builtins.int]]" |
| 37 | +reveal_type(batched([0, 0, 0, 0, 0], 5, strict=True)) # N: Revealed type is "itertools.batched[tuple[builtins.int, builtins.int, builtins.int, builtins.int, builtins.int]]" |
| 38 | + |
| 39 | +reveal_type(batched([0], 2),) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]" |
| 40 | +reveal_type(batched([0], 2, strict=False)) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]" |
| 41 | + |
| 42 | +def f() -> int: |
| 43 | + return 3 |
| 44 | + |
| 45 | +reveal_type(batched([0, 0, 0], f(), strict=True)) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]" |
| 46 | + |
| 47 | +[builtins fixtures/tuple.pyi] |
0 commit comments