mirror of
https://github.com/graphql-python/graphene.git
synced 2025-07-18 03:52:24 +03:00
add some more complicated tests
This commit is contained in:
parent
b7404ecf81
commit
cc1e60c911
|
@ -486,9 +486,6 @@ def test_enum_inheritance():
|
||||||
class Query(ObjectType):
|
class Query(ObjectType):
|
||||||
color = ChildRGB(required=True)
|
color = ChildRGB(required=True)
|
||||||
|
|
||||||
def resolve_color(_, info):
|
|
||||||
return ChildRGB.RED
|
|
||||||
|
|
||||||
schema = Schema(query=Query)
|
schema = Schema(query=Query)
|
||||||
assert str(schema) == dedent(
|
assert str(schema) == dedent(
|
||||||
'''\
|
'''\
|
||||||
|
@ -502,3 +499,49 @@ def test_enum_inheritance():
|
||||||
}
|
}
|
||||||
'''
|
'''
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_multiple_enum_inheritance():
|
||||||
|
class Parent1RGB(Enum):
|
||||||
|
RED = 1
|
||||||
|
|
||||||
|
class Parent2RGB(Enum):
|
||||||
|
BLUE = 2
|
||||||
|
|
||||||
|
class ChildRGB(Enum):
|
||||||
|
GREEN = 3
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
enums = (Parent1RGB, Parent2RGB,)
|
||||||
|
|
||||||
|
class Query(ObjectType):
|
||||||
|
color = ChildRGB(required=True)
|
||||||
|
|
||||||
|
schema = Schema(query=Query)
|
||||||
|
assert str(schema) == dedent(
|
||||||
|
'''\
|
||||||
|
type Query {
|
||||||
|
color: ChildRGB!
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ChildRGB {
|
||||||
|
RED
|
||||||
|
BLUE
|
||||||
|
GREEN
|
||||||
|
}
|
||||||
|
'''
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def test_override_enum_inheritance():
|
||||||
|
class ParentRGB(Enum):
|
||||||
|
RED = 1
|
||||||
|
BLUE = 2
|
||||||
|
|
||||||
|
class ChildRGB(Enum):
|
||||||
|
BLUE = 3
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
enums = (ParentRGB,)
|
||||||
|
|
||||||
|
assert ChildRGB.get(3) != ParentRGB.BLUE
|
||||||
|
|
Loading…
Reference in New Issue
Block a user