Skip to content

Commit d8a7e77

Browse files
committed
test Enum class cannot be generic
1 parent 3c16eea commit d8a7e77

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test-data/unit/check-enum.test

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ reveal_type(Medal.bronze) # E: Revealed type is '__main__.Medal'
3131
m = Medal.gold
3232
m = 1 # E: Incompatible types in assignment (expression has type "int", variable has type "Medal")
3333

34+
[case testEnumFromEnumMetaGeneric]
35+
from enum import EnumMeta
36+
from typing import Generic, TypeVar
37+
T = TypeVar("T")
38+
class Medal(Generic[T], metaclass=EnumMeta): # E: Enum class cannot be generic
39+
q = None
40+
3441
[case testEnumNameAndValue]
3542
from enum import Enum
3643
class Truth(Enum):

0 commit comments

Comments
 (0)