Skip to content

Commit 953b62b

Browse files
committed
Add some tests
1 parent 3fc5bb1 commit 953b62b

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

graphql/type/tests/test_definition.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,31 @@ def test_defines_a_subscription_schema():
118118
# assert subscription.name == 'articleSubscribe'
119119

120120

121+
def test_defines_an_enum_type_with_deprecated_value():
122+
EnumTypeWithDeprecatedValue = GraphQLEnumType('EnumWithDeprecatedValue', {
123+
'foo': GraphQLEnumValue(deprecation_reason='Just because'),
124+
})
125+
value = EnumTypeWithDeprecatedValue.getValues()[0]
126+
assert value.name == 'foo'
127+
assert value.description is None
128+
assert value.is_deprecated is True
129+
assert value.deprecation_reason == 'Just because'
130+
assert value.value == 'foo'
131+
132+
133+
def test_defines_an_enum_type_with_a_value_of_none():
134+
EnumTypeWithNoneValue = GraphQLEnumType('EnumWithNullishValue', {
135+
'NULL': GraphQLEnumValue(None),
136+
})
137+
138+
value = EnumTypeWithNoneValue.getValues()[0]
139+
assert value.name == 'NULL'
140+
assert value.description is None
141+
assert value.is_deprecated is False
142+
assert value.deprecation_reason is None
143+
assert value.value is None
144+
145+
121146
def test_includes_nested_input_objects_in_the_map():
122147
NestedInputObject = GraphQLInputObjectType(
123148
name='NestedInputObject',

0 commit comments

Comments
 (0)