File tree 1 file changed +6
-2
lines changed 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1460,15 +1460,19 @@ _testNoCrashOnGenericUnionUnpacking.py:15: error: Revealed type is 'Union[builti
1460
1460
_testNoCrashOnGenericUnionUnpacking.py:16: error: Revealed type is 'Union[builtins.int*, builtins.str*]'
1461
1461
1462
1462
[case testEnumIteration]
1463
+ # Regression test for #2305
1464
+ # Tests that:
1465
+ # - Mypy allows iteration over enum classes in comprehensions and for-loops
1466
+ # - The inferred element type in such iteration contexts is the enum type
1463
1467
from enum import Enum
1464
1468
class E(Enum):
1465
1469
A = 'a'
1466
1470
(reveal_type(e) for e in E)
1467
1471
for e in E:
1468
1472
reveal_type(e)
1469
1473
[out]
1470
- _testEnumIteration.py:4 : error: Revealed type is '_testEnumIteration.E*'
1471
- _testEnumIteration.py:6 : error: Revealed type is '_testEnumIteration.E*'
1474
+ _testEnumIteration.py:8 : error: Revealed type is '_testEnumIteration.E*'
1475
+ _testEnumIteration.py:10 : error: Revealed type is '_testEnumIteration.E*'
1472
1476
1473
1477
[case testEnumIterable]
1474
1478
from enum import Enum
You can’t perform that action at this time.
0 commit comments