@@ -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 .get_values ()[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 .get_values ()[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+
121146def test_defines_an_object_type_with_deprecated_field ():
122147 TypeWithDeprecatedField = GraphQLObjectType ('foo' , fields = {
123148 'bar' : GraphQLField (
@@ -178,6 +203,23 @@ def test_includes_nested_input_objects_in_the_map():
178203 assert schema .get_type_map ()['NestedInputObject' ] is NestedInputObject
179204
180205
206+ def test_includes_interface_possible_types_in_the_type_map ():
207+ SomeInterface = GraphQLInterfaceType ('SomeInterface' , fields = {'f' : GraphQLField (GraphQLInt )})
208+ SomeSubtype = GraphQLObjectType (
209+ name = 'SomeSubtype' ,
210+ fields = {'f' : GraphQLField (GraphQLInt )},
211+ interfaces = [SomeInterface ],
212+ is_type_of = lambda : None
213+ )
214+ schema = GraphQLSchema (
215+ query = GraphQLObjectType (
216+ name = 'Query' ,
217+ fields = {
218+ 'iface' : GraphQLField (SomeInterface )}),
219+ types = [SomeSubtype ])
220+ assert schema .get_type_map ()['SomeSubtype' ] == SomeSubtype
221+
222+
181223def test_includes_interfaces_thunk_subtypes_in_the_type_map ():
182224 SomeInterface = GraphQLInterfaceType (
183225 name = 'SomeInterface' ,
@@ -205,23 +247,6 @@ def test_includes_interfaces_thunk_subtypes_in_the_type_map():
205247 assert schema .get_type_map ()['SomeSubtype' ] is SomeSubtype
206248
207249
208- def test_includes_interfaces_subtypes_in_the_type_map ():
209- SomeInterface = GraphQLInterfaceType ('SomeInterface' , fields = {'f' : GraphQLField (GraphQLInt )})
210- SomeSubtype = GraphQLObjectType (
211- name = 'SomeSubtype' ,
212- fields = {'f' : GraphQLField (GraphQLInt )},
213- interfaces = [SomeInterface ],
214- is_type_of = lambda : None
215- )
216- schema = GraphQLSchema (
217- query = GraphQLObjectType (
218- name = 'Query' ,
219- fields = {
220- 'iface' : GraphQLField (SomeInterface )}),
221- types = [SomeSubtype ])
222- assert schema .get_type_map ()['SomeSubtype' ] == SomeSubtype
223-
224-
225250def test_stringifies_simple_types ():
226251 assert str (GraphQLInt ) == 'Int'
227252 assert str (BlogArticle ) == 'Article'
0 commit comments