8000 Add comment to enum iteration test · python/mypy@191918e · GitHub
[go: up one dir, main page]

Skip to content

Commit 191918e

Browse files
committed
Add comment to enum iteration test
1 parent 6e68941 commit 191918e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test-data/unit/pythoneval.test

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1460,15 +1460,19 @@ _testNoCrashOnGenericUnionUnpacking.py:15: error: Revealed type is 'Union[builti
14601460
_testNoCrashOnGenericUnionUnpacking.py:16: error: Revealed type is 'Union[builtins.int*, builtins.str*]'
14611461

14621462
[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
14631467
from enum import Enum
14641468
class E(Enum):
14651469
A = 'a'
14661470
(reveal_type(e) for e in E)
14671471
for e in E:
14681472
reveal_type(e)
14691473
[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*'
14721476

14731477
[case testEnumIterable]
14741478
from enum import Enum

0 commit comments

Comments
 (0)
0