Skip to content

Commit ee271c5

Browse files
committed
error
1 parent abdb514 commit ee271c5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

mypy/semanal_enum.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ class A(enum.Enum):
104104
if fullname not in ENUM_BASES:
105105
return None
106106

107-
new_class_name, items, values, ok = self.parse_enum_call_args(call, fullname.split(".")[-1])
107+
new_class_name, items, values, ok = self.parse_enum_call_args(
108+
call, fullname.split(".")[-1]
109+
)
108110
if not ok:
109111
# Error. Construct dummy return value.
110112
name = var_name

test-data/unit/check-enum.test

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,8 @@ V = Enum('U', **{'a': 1}) # E: Unexpected arguments to Enum()
481481
W = Enum('W', 'a b')
482482
W.c # E: "Type[W]" has no attribute "c"
483483
X = Enum('Something', 'a b') # E: String argument 1 "Something" to enum.Enum(...) does not match variable name "X"
484+
reveal_type(X.a) # N: Revealed type is "Literal[[email protected]]?"
485+
X.asdf # E: "Type[Something@23]" has no attribute "asdf"
484486

485487
[typing fixtures/typing-medium.pyi]
486488

0 commit comments

Comments
 (0)