Skip to content

Commit ba51921

Browse files
committed
Added simple eval test for Enum.
1 parent 8b82aa8 commit ba51921

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

mypy/test/data/pythoneval-enum.test

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
-- Test cases for type checking mypy programs using full stubs and running
2+
-- using CPython.
3+
--
4+
-- These are mostly regression tests -- no attempt is made to make these
5+
-- complete.
6+
--
7+
-- This test file checks Enum
8+
9+
[case testEnum]
10+
from enum import Enum
11+
class Medal(Enum):
12+
gold = 1
13+
silver = 2
14+
bronze = 3
15+
m = Medal.gold
16+
m = 1
17+
[out]
18+
_program.py, line 7: Incompatible types in assignment (expression has type "int", variable has type "Medal")

mypy/test/testpythoneval.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
python_eval_files = ['pythoneval.test',
2828
'python2eval.test']
2929

30-
python_34_eval_files = ['pythoneval-asyncio.test']
30+
python_34_eval_files = ['pythoneval-asyncio.test',
31+
'pythoneval-enum.test']
3132

3233
# Path to Python 3 interpreter
3334
python3_path = sys.executable

0 commit comments

Comments
 (0)