mirror of
https://github.com/graphql-python/graphene.git
synced 2025-12-10 19:54:16 +03:00
Add test
This commit is contained in:
parent
8290326308
commit
21e18ae14c
|
|
@ -1,9 +1,10 @@
|
||||||
from graphql import Undefined
|
from graphql import Undefined
|
||||||
|
import pytest
|
||||||
|
|
||||||
from ..argument import Argument
|
from ..argument import Argument
|
||||||
from ..field import Field
|
from ..field import Field
|
||||||
from ..inputfield import InputField
|
from ..inputfield import InputField
|
||||||
from ..inputobjecttype import InputObjectType
|
from ..inputobjecttype import InputObjectType, InputObjectTypeContainer
|
||||||
from ..objecttype import ObjectType
|
from ..objecttype import ObjectType
|
||||||
from ..scalars import Boolean, String
|
from ..scalars import Boolean, String
|
||||||
from ..schema import Schema
|
from ..schema import Schema
|
||||||
|
|
@ -167,3 +168,16 @@ def test_inputobjecttype_default_input_as_undefined(
|
||||||
|
|
||||||
assert not result.errors
|
assert not result.errors
|
||||||
assert result.data == {"undefinedOptionalsWork": True}
|
assert result.data == {"undefinedOptionalsWork": True}
|
||||||
|
|
||||||
|
|
||||||
|
def test_inputobjecttype_explicit_container():
|
||||||
|
class MyInputObjectType(InputObjectType):
|
||||||
|
class Meta:
|
||||||
|
container = InputObjectTypeContainer
|
||||||
|
|
||||||
|
first_name = String()
|
||||||
|
last_name = String()
|
||||||
|
|
||||||
|
container = MyInputObjectType._meta.container(first_name="John")
|
||||||
|
assert container.first_name == "John"
|
||||||
|
assert container.last_name is None
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user