mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-02 20:54:16 +03:00
Improved error messaging
This commit is contained in:
parent
feb8fb9b13
commit
c4fba3b7ca
|
@ -61,8 +61,8 @@ class Field(OrderedType):
|
||||||
self._type = type
|
self._type = type
|
||||||
self.args = args or OrderedDict()
|
self.args = args or OrderedDict()
|
||||||
# self.args = to_arguments(args, extra_args)
|
# self.args = to_arguments(args, extra_args)
|
||||||
assert not (source and resolver), ('You cannot provide a source and a '
|
assert not (source and resolver), ('A Field cannot have a source and a '
|
||||||
'resolver in a Field at the same time.')
|
'resolver in at the same time.')
|
||||||
if source:
|
if source:
|
||||||
resolver = partial(source_resolver, source)
|
resolver = partial(source_resolver, source)
|
||||||
self.resolver = resolver
|
self.resolver = resolver
|
||||||
|
|
|
@ -47,7 +47,7 @@ def test_field_not_source_and_resolver():
|
||||||
MyType = object()
|
MyType = object()
|
||||||
with pytest.raises(Exception) as exc_info:
|
with pytest.raises(Exception) as exc_info:
|
||||||
Field(MyType, source='value', resolver=lambda: None)
|
Field(MyType, source='value', resolver=lambda: None)
|
||||||
assert str(exc_info.value) == 'You cannot provide a source and a resolver in a Field at the same time.'
|
assert str(exc_info.value) == 'A Field cannot have a source and a resolver in at the same time.'
|
||||||
|
|
||||||
def test_field_source_func():
|
def test_field_source_func():
|
||||||
MyType = object()
|
MyType = object()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user