@@ -291,11 +291,12 @@ def test_builds_a_schema_with_an_enum():
291291 assert isinstance (clientFoodEnum , GraphQLEnumType )
292292
293293 assert clientFoodEnum .get_values () == [
294- GraphQLEnumValue (name = 'VEGETABLES' , value = 'VEGETABLES' , description = 'Foods that are vegetables.' ),
295- GraphQLEnumValue (name = 'FRUITS' , value = 'FRUITS' , description = 'Foods that are fruits.' ),
296- GraphQLEnumValue (name = 'OILS' , value = 'OILS' , description = 'Foods that are oils.' ),
297- GraphQLEnumValue (name = 'DAIRY' , value = 'DAIRY' , description = 'Foods that are dairy.' ),
298- GraphQLEnumValue (name = 'MEAT' , value = 'MEAT' , description = 'Foods that are meat.' )
294+ GraphQLEnumValue (name = 'VEGETABLES' , value = 'VEGETABLES' , description = 'Foods that are vegetables.' ,
295+ deprecation_reason = None ),
296+ GraphQLEnumValue (name = 'FRUITS' , value = 'FRUITS' , description = 'Foods that are fruits.' , deprecation_reason = None ),
297+ GraphQLEnumValue (name = 'OILS' , value = 'OILS' , description = 'Foods that are oils.' , deprecation_reason = None ),
298+ GraphQLEnumValue (name = 'DAIRY' , value = 'DAIRY' , description = 'Foods that are dairy.' , deprecation_reason = None ),
299+ GraphQLEnumValue (name = 'MEAT' , value = 'MEAT' , description = 'Foods that are meat.' , deprecation_reason = None )
299300 ]
300301
301302
@@ -381,6 +382,40 @@ def test_builds_a_schema_with_field_arguments_with_default_values():
381382 _test_schema (schema )
382383
383384
385+ def test_builds_a_schema_aware_of_deprecation ():
386+ schema = GraphQLSchema (
387+ query = GraphQLObjectType (
388+ name = 'Simple' ,
389+ description = 'This is a simple type' ,
390+ fields = OrderedDict ([
391+ ('shinyString' , GraphQLField (
392+ type = GraphQLString ,
393+ description = 'This is a shiny string field'
394+ )),
395+ ('deprecatedString' , GraphQLField (
396+ type = GraphQLString ,
397+ description = 'This is a deprecated string field' ,
398+ deprecation_reason = 'Use shinyString'
399+ )),
400+ ('color' , GraphQLField (
401+ type = GraphQLEnumType (
402+ name = 'Color' ,
403+ values = OrderedDict ([
404+ ('RED' , GraphQLEnumValue (description = 'So rosy' )),
405+ ('GREEN' , GraphQLEnumValue (description = 'So grassy' )),
406+ ('BLUE' , GraphQLEnumValue (description = 'So calming' )),
407+ ('MAUVE' , GraphQLEnumValue (description = 'So sickening' ,
408+ deprecation_reason = 'No longer in fashion' )),
409+ ])
410+ )
411+ ))
412+ ])
413+ )
414+ )
415+
416+ _test_schema (schema )
417+
418+
384419def test_cannot_use_client_schema_for_general_execution ():
385420 customScalar = GraphQLScalarType (
386421 name = 'CustomScalar' ,
0 commit comments