Skip to content

Commit

Permalink
add functional enum test
Browse files Browse the repository at this point in the history
  • Loading branch information
terencehonles committed May 6, 2024
1 parent f2cc574 commit 52ced72
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test-data/unit/check-python310.test
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,24 @@ match m:

[builtins fixtures/tuple.pyi]

[case testMatchLiteralPatternEnumFunctional]
from enum import Enum
from typing import NoReturn
def assert_never(x: NoReturn) -> None: ...

Medal = Enum('Medal', 'gold silver bronze')
m: Medal

match m:
case Medal.gold:
reveal_type(m) # N: Revealed type is "Literal[__main__.Medal.gold]"
case Medal.silver:
reveal_type(m) # N: Revealed type is "Literal[__main__.Medal.silver]"
case Medal.bronze:
reveal_type(m) # N: Revealed type is "Literal[__main__.Medal.bronze]"
case _ as unreachable:
assert_never(unreachable)

[case testMatchLiteralPatternEnumCustomEquals-skip]
from enum import Enum
class Medal(Enum):
Expand Down

0 comments on commit 52ced72

Please sign in to comment.