mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-16 19:12:21 +03:00
add failing test for enum inheritance
This commit is contained in:
parent
f039af2810
commit
5e050a6800
|
@ -471,3 +471,31 @@ def test_mutation_enum_input_type():
|
|||
assert result.data == {"createPaint": {"color": "RED"}}
|
||||
|
||||
assert color_input_value == RGB.RED
|
||||
|
||||
|
||||
def test_enum_inheritance():
|
||||
class ParentRGB(Enum):
|
||||
RED = 1
|
||||
|
||||
class ChildRGB(ParentRGB, Enum):
|
||||
BLUE = 2
|
||||
|
||||
class Query(ObjectType):
|
||||
color = ChildRGB(required=True)
|
||||
|
||||
def resolve_color(_, info):
|
||||
return ChildRGB.RED
|
||||
|
||||
schema = Schema(query=Query)
|
||||
assert str(schema) == dedent(
|
||||
'''\
|
||||
type Query {
|
||||
color: ChildRGB!
|
||||
}
|
||||
|
||||
enum ChildRGB {
|
||||
RED
|
||||
BLUE
|
||||
}
|
||||
'''
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user