Enum values are returned as dict in core-next

This commit is contained in:
Christoph Zwerschke 2019-06-30 22:02:50 +02:00 committed by Mel van Londen
parent 8106fff522
commit c8adab675a

View File

@ -80,36 +80,15 @@ def test_enum_from_builtin_enum_accepts_lambda_description():
class Query(ObjectType): class Query(ObjectType):
foo = Episode() foo = Episode()
schema = Schema(query=Query) schema = Schema(query=Query).graphql_schema
GraphQLPyEpisode = schema._type_map["PyEpisode"].values episode = schema.get_type("PyEpisode")
assert schema._type_map["PyEpisode"].description == "StarWars Episodes" assert episode.description == "StarWars Episodes"
assert ( assert [(name, value.description, value.deprecation_reason)
GraphQLPyEpisode[0].name == "NEWHOPE" for name, value in episode.values.items()] == [
and GraphQLPyEpisode[0].description == "New Hope Episode" ('NEWHOPE', 'New Hope Episode', 'meh'),
) ('EMPIRE', 'Other', None), ('JEDI', 'Other', None)]
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 is None
)
assert (
GraphQLPyEpisode[2].name == "JEDI"
and GraphQLPyEpisode[2].deprecation_reason is None
)
def test_enum_from_python3_enum_uses_enum_doc(): def test_enum_from_python3_enum_uses_enum_doc():