Skip to content

Commit 6a179f7

Browse files
Add more comphrenensive tests
Inspired by @Copilot in saulshanabrook@35ae089
1 parent 003686d commit 6a179f7

File tree

1 file changed

+24
-6
lines changed

1 file changed

+24
-6
lines changed

test-data/unit/check-python310.test

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,12 +1559,30 @@ match m6:
15591559

15601560
[builtins fixtures/tuple.pyi]
15611561

1562-
[case testMatchTupleFields]
1563-
x: tuple[int, str] | None
1564-
match x:
1565-
case (a, b):
1566-
reveal_type(a) # N: Revealed type is "int"
1567-
reveal_type(b) # N: Revealed type is "str"
1562+
[case testMatchTupleUnions]
1563+
m1: tuple[int, str] | None
1564+
match m1:
1565+
case (a1, b1):
1566+
reveal_type(a1) # N: Revealed type is "int"
1567+
reveal_type(b1) # N: Revealed type is "str"
1568+
1569+
m2: tuple[int, str] | tuple[float, str]
1570+
match m2:
1571+
case (a2, b2):
1572+
reveal_type(a2) # N: Revealed type is "Union[int, float]"
1573+
reveal_type(b2) # N: Revealed type is "str"
1574+
1575+
m3: tuple[int] | tuple[float, str]
1576+
match m3:
1577+
case (a3, b3):
1578+
reveal_type(a3) # N: Revealed type is "float"
1579+
reveal_type(b3) # N: Revealed type is "str"
1580+
1581+
m4: tuple[int] | list[str]
1582+
match m4:
1583+
case (a4, b4):
1584+
reveal_type(a4) # N: Revealed type is "float"
1585+
reveal_type(b4) # N: Revealed type is "str"
15681586

15691587
[builtins fixtures/tuple.pyi]
15701588

0 commit comments

Comments
 (0)