mirror of
https://github.com/graphql-python/graphene.git
synced 2025-02-02 12:44:15 +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.args = args or OrderedDict()
|
||||
# self.args = to_arguments(args, extra_args)
|
||||
assert not (source and resolver), ('You cannot provide a source and a '
|
||||
'resolver in a Field at the same time.')
|
||||
assert not (source and resolver), ('A Field cannot have a source and a '
|
||||
'resolver in at the same time.')
|
||||
if source:
|
||||
resolver = partial(source_resolver, source)
|
||||
self.resolver = resolver
|
||||
|
|
|
@ -47,7 +47,7 @@ def test_field_not_source_and_resolver():
|
|||
MyType = object()
|
||||
with pytest.raises(Exception) as exc_info:
|
||||
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():
|
||||
MyType = object()
|
||||
|
|
Loading…
Reference in New Issue
Block a user