Skip to content

Commit d7fded7

Browse files
committed
Improved Enum coverage
1 parent e1e2432 commit d7fded7

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

graphene/types/tests/test_enum.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
from ..enum import Enum, PyEnum
2+
from ..field import Field
3+
from ..inputfield import InputField
4+
from ..argument import Argument
25

36

47
def test_enum_construction():
@@ -72,3 +75,39 @@ class RGB(Enum):
7275
assert RGB.RED.value == 1
7376
assert RGB.GREEN.value == 2
7477
assert RGB.BLUE.value == 3
78+
79+
80+
def test_enum_value_as_unmounted_field():
81+
class RGB(Enum):
82+
RED = 1
83+
GREEN = 2
84+
BLUE = 3
85+
86+
unmounted = RGB()
87+
unmounted_field = unmounted.Field()
88+
assert isinstance(unmounted_field, Field)
89+
assert unmounted_field.type == RGB
90+
91+
92+
def test_enum_value_as_unmounted_inputfield():
93+
class RGB(Enum):
94+
RED = 1
95+
GREEN = 2
96+
BLUE = 3
97+
98+
unmounted = RGB()
99+
unmounted_field = unmounted.InputField()
100+
assert isinstance(unmounted_field, InputField)
101+
assert unmounted_field.type == RGB
102+
103+
104+
def test_enum_value_as_unmounted_argument():
105+
class RGB(Enum):
106+
RED = 1
107+
GREEN = 2
108+
BLUE = 3
109+
110+
unmounted = RGB()
111+
unmounted_field = unmounted.Argument()
112+
assert isinstance(unmounted_field, Argument)
113+
assert unmounted_field.type == RGB

0 commit comments

Comments
 (0)