mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-29 21:13:58 +03:00
Improved Field coverage
This commit is contained in:
parent
d7fded7d98
commit
ecdfed257c
|
@ -3,6 +3,7 @@ import pytest
|
|||
from ..argument import Argument
|
||||
from ..field import Field
|
||||
from ..structures import NonNull
|
||||
from ..scalars import String
|
||||
|
||||
|
||||
class MyInstance(object):
|
||||
|
@ -75,6 +76,20 @@ def test_field_source_func():
|
|||
assert field.resolver(MyInstance(), {}, None, None) == MyInstance.value_func()
|
||||
|
||||
|
||||
def test_field_source_as_argument():
|
||||
MyType = object()
|
||||
field = Field(MyType, source=String())
|
||||
assert 'source' in field.args
|
||||
assert field.args['source'].type == String
|
||||
|
||||
|
||||
def test_field_name_as_argument():
|
||||
MyType = object()
|
||||
field = Field(MyType, name=String())
|
||||
assert 'name' in field.args
|
||||
assert field.args['name'].type == String
|
||||
|
||||
|
||||
def test_field_source_argument_as_kw():
|
||||
MyType = object()
|
||||
field = Field(MyType, b=NonNull(True), c=Argument(None), a=NonNull(False))
|
||||
|
|
Loading…
Reference in New Issue
Block a user