File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -1552,10 +1552,10 @@ def anytype() -> mypy.types.AnyType:
1552
1552
fallback = mypy .types .Instance (type_info , [anytype () for _ in type_info .type_vars ])
1553
1553
1554
1554
value : bool | int | str
1555
- if isinstance (runtime , bytes ):
1556
- value = bytes_to_human_readable_repr (runtime )
1557
- elif isinstance (runtime , enum .Enum ) and isinstance (runtime .name , str ):
1555
+ if isinstance (runtime , enum .Enum ) and isinstance (runtime .name , str ):
1558
1556
value = runtime .name
1557
+ elif isinstance (runtime , bytes ):
1558
+ value = bytes_to_human_readable_repr (runtime )
1559
1559
elif isinstance (runtime , (bool , int , str )):
1560
1560
value = runtime
1561
1561
else :
Original file line number Diff line number Diff line change @@ -1068,6 +1068,26 @@ def spam(x=Flags4(0)): pass
1068
1068
""" ,
1069
1069
error = "spam" ,
1070
1070
)
1071
+ yield Case (
1072
+ stub = """
1073
+ from typing_extensions import Final, Literal
1074
+ class BytesEnum(bytes, enum.Enum):
1075
+ a: bytes
1076
+ FOO: Literal[BytesEnum.a]
1077
+ BAR: Final = BytesEnum.a
1078
+ BAZ: BytesEnum
1079
+ EGGS: bytes
1080
+ """ ,
1081
+ runtime = """
1082
+ class BytesEnum(bytes, enum.Enum):
1083
+ a = b'foo'
1084
+ FOO = BytesEnum.a
1085
+ BAR = BytesEnum.a
1086
+ BAZ = BytesEnum.a
1087
+ EGGS = BytesEnum.a
1088
+ """ ,
1089
+ error = None ,
1090
+ )
1071
1091
1072
1092
@collect_cases
1073
1093
def test_decorator (self ) -> Iterator [Case ]:
You can’t perform that action at this time.
0 commit comments