File tree 1 file changed +45
-0
lines changed
1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -1458,3 +1458,48 @@ _testNoCrashOnGenericUnionUnpacking.py:10: error: Revealed type is 'Union[builti
1458
1458
_testNoCrashOnGenericUnionUnpacking.py:11: error: Revealed type is 'Union[builtins.str, builtins.int]'
1459
1459
_testNoCrashOnGenericUnionUnpacking.py:15: error: Revealed type is 'Union[builtins.int*, builtins.str*]'
1460
1460
_testNoCrashOnGenericUnionUnpacking.py:16: error: Revealed type is 'Union[builtins.int*, builtins.str*]'
1461
+
1462
+ [case testEnumIteration]
1463
+ from enum import Enum
1464
+ class E(Enum):
1465
+ A = 'a'
1466
+ l = [e for e in E]
1467
+ reveal_type(l[0])
1468
+ for e in E:
1469
+ reveal_type(e)
1470
+ [out]
1471
+ _testEnumIteration.py:5: error: Revealed type is '_testEnumIteration.E*'
1472
+ _testEnumIteration.py:7: error: Revealed type is '_testEnumIteration.E*'
1473
+
1474
+ [case testEnumIterable]
1475
+ from enum import Enum
1476
+ from typing import Iterable
1477
+ class E(Enum):
1478
+ a = 'a'
1479
+ def f(ie:Iterable[E]):
1480
+ pass
1481
+ f(E)
1482
+
1483
+ [case testIntEnumIterable]
1484
+ from enum import IntEnum
1485
+ from typing import Iterable
1486
+ class N(IntEnum):
1487
+ x = 1
1488
+ def f(ni: Iterable[N]):
1489
+ pass
1490
+ def g(ii: Iterable[int]):
1491
+ pass
1492
+ f(N)
1493
+ g(N)
1494
+
1495
+ [case testDerivedEnumIterable]
1496
+ from enum import Enum
1497
+ from typing import Iterable
1498
+ class E(str, Enum):
1499
+ a = 'foo'
1500
+ def f(ei: Iterable[E]):
1501
+ pass
1502
+ def g(si: Iterable[str]):
1503
+ pass
1504
+ f(E)
1505
+ g(E)
You can’t perform that action at this time.
0 commit comments