@@ -150,7 +150,7 @@ _program.py:7: error: Revealed type is 'builtins.int'
150
150
[case testFunctionalEnumListOfStrings]
151
151
from enum import Enum, IntEnum
152
152
E = Enum('E', ('foo', 'bar'))
153
- F = Enum ('F', ['bar', 'baz'])
153
+ F = IntEnum ('F', ['bar', 'baz'])
154
154
reveal_type(E.foo)
155
155
reveal_type(F.baz)
156
156
[out]
@@ -160,7 +160,7 @@ _program.py:5: error: Revealed type is '_testFunctionalEnumListOfStrings.F'
160
160
[case testFunctionalEnumListOfPairs]
161
161
from enum import Enum, IntEnum
162
162
E = Enum('E', [('foo', 1), ['bar', 2]])
163
- F = Enum ('F', (['bar', 1], ('baz', 2)))
163
+ F = IntEnum ('F', (['bar', 1], ('baz', 2)))
164
164
reveal_type(E.foo)
165
165
reveal_type(F.baz)
166
166
reveal_type(E.foo.value)
@@ -202,6 +202,7 @@ N = IntEnum('M', [])
202
202
P = Enum('P', [42])
203
203
Q = Enum('Q', [('a', 42, 0)])
204
204
R = IntEnum('R', [[0, 42]])
205
+ S = Enum('S', {1: 1})
205
206
[out]
206
207
_program.py:2: error: Too few arguments for Enum()
207
208
_program.py:3: error: Enum() expects a string, tuple, list or dict literal as the second argument
@@ -215,6 +216,7 @@ _program.py:10: error: Too many arguments for IntEnum()
215
216
_program.py:11: error: Enum() needs at least one item
216
217
_program.py:12: error: Enum() needs at least one item
217
218
_program.py:13: error: IntEnum() needs at least one item
218
- _program.py:14: error: Enum() with tuple or list of (name, value) pairs not yet supported
219
- _program.py:15: error: Enum() with tuple or list of (name, value) pairs not yet supported
220
- _program.py:16: error: IntEnum() with tuple or list of (name, value) pairs not yet supported
219
+ _program.py:14: error: Enum() with tuple or list expects strings or (name, value) pairs
220
+ _program.py:15: error: Enum() with tuple or list expects strings or (name, value) pairs
221
+ _program.py:16: error: IntEnum() with tuple or list expects strings or (name, value) pairs
222
+ _program.py:17: error: Enum() with dict literal requires string literals
0 commit comments