mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-22 05:49:59 +03:00
Fix tests
This commit is contained in:
parent
c30d8d0231
commit
3327ca47c2
|
@ -7,6 +7,7 @@ from graphql import (
|
|||
GraphQLObjectType,
|
||||
GraphQLScalarType,
|
||||
GraphQLUnionType,
|
||||
Undefined,
|
||||
)
|
||||
|
||||
|
||||
|
@ -49,7 +50,7 @@ class GrapheneEnumType(GrapheneGraphQLType, GraphQLEnumType):
|
|||
try:
|
||||
value = enum[value]
|
||||
except KeyError:
|
||||
value = None
|
||||
return Undefined
|
||||
return super(GrapheneEnumType, self).serialize(value)
|
||||
|
||||
|
||||
|
|
|
@ -234,8 +234,10 @@ def test_enum_types():
|
|||
from enum import Enum as PyEnum
|
||||
|
||||
class Color(PyEnum):
|
||||
"""Primary colors"""
|
||||
|
||||
RED = 1
|
||||
GREEN = 2
|
||||
YELLOW = 2
|
||||
BLUE = 3
|
||||
|
||||
GColor = Enum.from_enum(Color)
|
||||
|
@ -250,16 +252,16 @@ def test_enum_types():
|
|||
|
||||
assert str(schema) == dedent(
|
||||
'''\
|
||||
"""An enumeration."""
|
||||
enum Color {
|
||||
RED
|
||||
GREEN
|
||||
BLUE
|
||||
}
|
||||
|
||||
type Query {
|
||||
color: Color!
|
||||
}
|
||||
|
||||
"""Primary colors"""
|
||||
enum Color {
|
||||
RED
|
||||
YELLOW
|
||||
BLUE
|
||||
}
|
||||
'''
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user