Skip to content

Commit bc6335c

Browse files
Create check_zip.py (#12233)
1 parent aa44da6 commit bc6335c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from __future__ import annotations
2+
3+
from typing import Sequence, Tuple
4+
from typing_extensions import assert_type
5+
6+
ints: Sequence[int] = [1, 2, 3]
7+
strs: Sequence[str] = ["one", "two", "three"]
8+
floats: Sequence[float] = [1.0, 2.0, 3.0]
9+
str_tuples: Sequence[Tuple[str]] = list((x,) for x in strs)
10+
11+
assert_type(zip(ints), zip[Tuple[int]])
12+
assert_type(zip(ints, strs), zip[Tuple[int, str]])
13+
assert_type(zip(ints, strs, floats), zip[Tuple[int, str, float]])
14+
assert_type(zip(strs, ints, floats, ints), zip[Tuple[str, int, float, int]])
15+
assert_type(zip(strs, ints, floats, ints, str_tuples), zip[Tuple[str, int, float, int, Tuple[str]]])

0 commit comments

Comments
 (0)