From 90272e5297525b49009a5d803650f1139022b24d Mon Sep 17 00:00:00 2001 From: Eran Kampf Date: Mon, 30 Oct 2017 10:31:13 -0700 Subject: [PATCH] Increase test coverage --- graphene/types/tests/test_enum.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/graphene/types/tests/test_enum.py b/graphene/types/tests/test_enum.py index f2856866..c4cf3b85 100644 --- a/graphene/types/tests/test_enum.py +++ b/graphene/types/tests/test_enum.py @@ -76,8 +76,11 @@ def test_enum_from_builtin_enum_accepts_lambda_description(): return 'New Hope Episode' if value == Episode.NEWHOPE else 'Other' + def custom_deprecation_reason(value): + return 'meh' if value == Episode.NEWHOPE else None + PyEpisode = PyEnum('PyEpisode', 'NEWHOPE,EMPIRE,JEDI') - Episode = Enum.from_enum(PyEpisode, description=custom_description) + Episode = Enum.from_enum(PyEpisode, description=custom_description, deprecation_reason=custom_deprecation_reason) class Query(ObjectType): foo = Episode() @@ -91,6 +94,10 @@ def test_enum_from_builtin_enum_accepts_lambda_description(): assert GraphQLPyEpisode[1].name == 'EMPIRE' and GraphQLPyEpisode[1].description == 'Other' assert GraphQLPyEpisode[2].name == 'JEDI' and GraphQLPyEpisode[2].description == 'Other' + assert GraphQLPyEpisode[0].name == 'NEWHOPE' and GraphQLPyEpisode[0].deprecation_reason == 'meh' + assert GraphQLPyEpisode[1].name == 'EMPIRE' and GraphQLPyEpisode[1].deprecation_reason == None + assert GraphQLPyEpisode[2].name == 'JEDI' and GraphQLPyEpisode[2].deprecation_reason == None + def test_enum_from_python3_enum_uses_enum_doc(): if not six.PY3: