Skip to content

Commit

Permalink
test: add unit test for capture pattern narrowing
Browse files Browse the repository at this point in the history
  • Loading branch information
shenyih0ng committed Nov 18, 2024
1 parent b23b85b commit a017ea5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test-data/unit/check-python310.test
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ match m:
case a:
reveal_type(a) # N: Revealed type is "__main__.A"

[case testMatchCapturePatternNarrows]
x: int | None
y: int

match x:
case None:
pass
case y:
reveal_type(y) # N: Revealed type is "builtins.int"

-- Literal Pattern --

[case testMatchLiteralPatternNarrows]
Expand Down

0 comments on commit a017ea5

Please sign in to comment.