-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Expand file tree
/
Copy pathcheck-itertools.test
More file actions
47 lines (32 loc) · 2.38 KB
/
check-itertools.test
File metadata and controls
47 lines (32 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
[case testItertoolsBatched312]
# flags: --python-version 3.12
from itertools import batched
b = batched([0], 1)
reveal_type(b) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]"
reveal_type(b.__next__()) # N: Revealed type is "builtins.tuple[builtins.int, ...]"
reveal_type(batched([0, 0], 2)) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]"
reveal_type(batched([0, 0, 0], 3)) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]"
reveal_type(batched([0, 0, 0, 0], 4)) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]"
reveal_type(batched([0, 0, 0, 0, 0], 5)) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]"
reveal_type(batched([0], 2)) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]"
reveal_type(batched([0], 2)) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]"
def f() -> int:
return 3
reveal_type(batched([0, 0, 0], f())) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]"
[builtins fixtures/tuple.pyi]
[case testItertoolsBatched313]
# flags: --python-version 3.13
from itertools import batched
b = batched([0], 1, strict=True)
reveal_type(b) # N: Revealed type is "itertools.batched[tuple[builtins.int]]"
reveal_type(b.__next__()) # N: Revealed type is "tuple[builtins.int]"
reveal_type(batched([0, 0], 2, strict=True)) # N: Revealed type is "itertools.batched[tuple[builtins.int, builtins.int]]"
reveal_type(batched([0, 0, 0], 3, strict=True)) # N: Revealed type is "itertools.batched[tuple[builtins.int, builtins.int, builtins.int]]"
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]]"
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]]"
reveal_type(batched([0], 2),) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]"
reveal_type(batched([0], 2, strict=False)) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]"
def f() -> int:
return 3
reveal_type(batched([0, 0, 0], f(), strict=True)) # N: Revealed type is "itertools.batched[builtins.tuple[builtins.int, ...]]"
[builtins fixtures/tuple.pyi]