From 92cb2c54b777381a43027aee157b6503cb35b9c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Simon?= Date: Tue, 2 Apr 2024 20:48:26 +0200 Subject: [PATCH] Add test cases with mismatching subject and target lengths --- test-data/unit/check-python310.test | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/test-data/unit/check-python310.test b/test-data/unit/check-python310.test index 892ab7e28297..3586c192275e 100644 --- a/test-data/unit/check-python310.test +++ b/test-data/unit/check-python310.test @@ -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]