diff --git a/test-data/unit/check-python310.test b/test-data/unit/check-python310.test index adbdb9c081f8c..303807ec1fb0c 100644 --- a/test-data/unit/check-python310.test +++ b/test-data/unit/check-python310.test @@ -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):