Skip to content

Commit d6ad59d

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

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

test-data/unit/check-enum.test

+8-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ class Medal(Achievement):
2929
bronze = None
3030
reveal_type(Medal.bronze) # E: Revealed type is '__main__.Medal'
3131
m = Medal.gold
32-
m = 1 # E: Incompatible types in assignment (expression has type "int", variable has type "Medal")
32+
m = 1 # E: Incompatible types inassignment (expression has type "int", variable has type "Medal")
33+
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
3340

3441
[case testEnumNameAndValue]
3542
from enum import Enum

0 commit comments

Comments
 (0)