Skip to content

Commit 81de341

Browse files
committed
removed tuple type from TupleEnum cause of test error in Python 3.8, use IntEnum from enum package
1 parent 27f81ce commit 81de341

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

tests/test_automapper_enum.py

+7-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
from enum import Enum
2-
from typing import Tuple
1+
from enum import Enum, IntEnum
32

43
from automapper import mapper
54

@@ -10,21 +9,21 @@ class StringEnum(str, Enum):
109
Value3 = "value3"
1110

1211

13-
class IntEnum(int, Enum):
12+
class IntValueEnum(IntEnum):
1413
Value1 = 1
1514
Value2 = 2
1615
Value3 = 3
1716

1817

19-
class TupleEnum(Tuple[str, str], Enum):
18+
class TupleEnum(Enum):
2019
Value1 = ("value", "1")
2120
Value2 = ("value", "2")
2221
Value3 = ("value", "3")
2322

2423

2524
class SourceClass:
2625
def __init__(
27-
self, string_value: StringEnum, int_value: IntEnum, tuple_value: TupleEnum
26+
self, string_value: StringEnum, int_value: IntValueEnum, tuple_value: TupleEnum
2827
) -> None:
2928
self.string_value = string_value
3029
self.int_value = int_value
@@ -33,17 +32,17 @@ def __init__(
3332

3433
class TargetClass:
3534
def __init__(
36-
self, string_value: StringEnum, int_value: IntEnum, tuple_value: TupleEnum
35+
self, string_value: StringEnum, int_value: IntValueEnum, tuple_value: TupleEnum
3736
) -> None:
3837
self.string_value = string_value
3938
self.int_value = int_value
4039
self.tuple_value = tuple_value
4140

4241

4342
def test_map__enum():
44-
src = SourceClass(StringEnum.Value1, IntEnum.Value2, TupleEnum.Value3)
43+
src = SourceClass(StringEnum.Value1, IntValueEnum.Value2, TupleEnum.Value3)
4544
dst = mapper.to(TargetClass).map(src)
4645

4746
assert dst.string_value == StringEnum.Value1
48-
assert dst.int_value == IntEnum.Value2
47+
assert dst.int_value == IntValueEnum.Value2
4948
assert dst.tuple_value == TupleEnum.Value3

0 commit comments

Comments
 (0)