Skip to content

Commit

Permalink
Add test cases with mismatching subject and target lengths
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Simon committed Apr 2, 2024
1 parent 1c33add commit 92cb2c5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions test-data/unit/check-python310.test
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,34 @@ match m, (n, o), (p, (q, r)):
reveal_type(r) # N: Revealed type is "Literal[5]"
[builtins fixtures/tuple.pyi]

[case testMatchSequencePatternSequencesLengthMismatchNoNarrowing]
m: int
n: str
o: bool

match m, n, o:
case [3, "foo"]:
pass
case [3, "foo", True, True]:
pass
[builtins fixtures/tuple.pyi]

[case testMatchSequencePatternSequencesLengthMismatchNoNarrowingRecursive]
m: int
n: int
o: int

match m, (n, o):
case [0]:
pass
case [0, 1, [2]]:
pass
case [0, [1]]:
pass
case [0, [1, 2, 3]]:
pass
[builtins fixtures/tuple.pyi]

-- Mapping Pattern --

[case testMatchMappingPatternCaptures]
Expand Down

0 comments on commit 92cb2c5

Please sign in to comment.