Created
September 17, 2015 01:26
-
-
Save woodb/05795c29334d17d06f2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GLOB sdist-make: graphql-py/setup.py | |
py26 inst-nodeps: graphql-py/.tox/dist/graphql-py-0.1a0.zip | |
py26 installed: argparse==1.3.0,flake8==2.4.1,graphql-py==0.1a0,mccabe==0.3.1,pep8==1.5.7,py==1.4.30,pyflakes==0.8.1,pytest==2.7.3,wheel==0.24.0 | |
py26 runtests: PYTHONHASHSEED='1943238851' | |
py26 runtests: commands[0] | py.test | |
============================= test session starts ============================== | |
platform darwin -- Python 2.6.9 -- py-1.4.30 -- pytest-2.7.3 | |
rootdir: graphql-py, inifile: | |
collected 203 items | |
tests/core_execution/test_executor.py F........... | |
tests/core_execution/test_executor_schema.py F | |
tests/core_execution/test_lists.py .... | |
tests/core_execution/test_mutations.py . | |
tests/core_execution/test_nonnull.py ........ | |
tests/core_execution/test_union_interface.py ...... | |
tests/core_execution/test_variables.py ......FFFF.......FF......F....FF.FFF... | |
tests/core_language/test_lexer.py .F.F.F.F | |
tests/core_language/test_parser.py FF.FF.. | |
tests/core_language/test_printer.py F..F | |
tests/core_language/test_visitor.py ....... | |
tests/core_starwars/test_query.py ............. | |
tests/core_starwars/test_validation.py .FFFF.. | |
tests/core_type/test_coercion.py .... | |
tests/core_type/test_definition.py .......F | |
tests/core_type/test_introspection.py .......... | |
tests/core_validation/test_fields_on_correct_type.py ......FFFFFFFF.FF. | |
tests/core_validation/test_fragments_on_composite_types.py ....FFFF | |
tests/core_validation/test_known_argument_names.py .......FFFF | |
tests/core_validation/test_known_type_names.py .F | |
tests/core_validation/test_lone_anonymous_operation.py ...... | |
tests/core_validation/test_scalar_leafs.py .FF.FFFFF | |
tests/core_validation/test_unique_operation_names.py ......FF | |
tests/core_validation/test_variables_are_input_types.py .F | |
=================================== FAILURES =================================== | |
_________________________ test_executes_arbitary_code __________________________ | |
def test_executes_arbitary_code(): | |
class Data(object): | |
a = 'Apple' | |
b = 'Banana' | |
c = 'Cookie' | |
d = 'Donut' | |
e = 'Egg' | |
f = 'Fish' | |
def pic(self, size=50): | |
return 'Pic of size: {}'.format(size) | |
def deep(self): | |
return DeepData() | |
def promise(self): | |
# FIXME: promise is unsupported | |
return Data() | |
class DeepData(object): | |
a = 'Already Been Done' | |
b = 'Boring' | |
c = ['Contrived', None, 'Confusing'] | |
def deeper(self): | |
return [Data(), None, Data()] | |
doc = ''' | |
query Example($size: Int) { | |
a, | |
b, | |
x: c | |
...c | |
f | |
...on DataType { | |
pic(size: $size) | |
promise { | |
a | |
} | |
} | |
deep { | |
a | |
b | |
c | |
deeper { | |
a | |
b | |
} | |
} | |
} | |
fragment c on DataType { | |
d | |
e | |
} | |
''' | |
ast = parse(doc) | |
expected = { | |
'a': 'Apple', | |
'b': 'Banana', | |
'x': 'Cookie', | |
'd': 'Donut', | |
'e': 'Egg', | |
'f': 'Fish', | |
'pic': 'Pic of size: 100', | |
'promise': { 'a': 'Apple' }, | |
'deep': { | |
'a': 'Already Been Done', | |
'b': 'Boring', | |
'c': [ 'Contrived', None, 'Confusing' ], | |
'deeper': [ | |
{ 'a': 'Apple', 'b': 'Banana' }, | |
None, | |
{ 'a': 'Apple', 'b': 'Banana' } ] } | |
} | |
DataType = GraphQLObjectType('DataType', lambda: { | |
'a': GraphQLField(GraphQLString), | |
'b': GraphQLField(GraphQLString), | |
'c': GraphQLField(GraphQLString), | |
'd': GraphQLField(GraphQLString), | |
'e': GraphQLField(GraphQLString), | |
'f': GraphQLField(GraphQLString), | |
'pic': GraphQLField( | |
args={'size': GraphQLArgument(GraphQLInt)}, | |
type=GraphQLString, | |
resolver=lambda obj, args, *_: obj.pic(args['size']), | |
), | |
'deep': GraphQLField(DeepDataType), | |
'promise': GraphQLField(DataType), | |
}) | |
DeepDataType = GraphQLObjectType('DeepDataType', { | |
'a': GraphQLField(GraphQLString), | |
'b': GraphQLField(GraphQLString), | |
'c': GraphQLField(GraphQLList(GraphQLString)), | |
'deeper': GraphQLField(GraphQLList(DataType)), | |
}) | |
schema = GraphQLSchema(query=DataType) | |
result = execute(schema, Data(), ast, 'Example', {'size': 100}) | |
> assert not result.errors | |
E assert not [{'locations': [SourceLocation(line=9, column=17)], 'message': 'zero length field name in format'}] | |
E + where [{'locations': [SourceLocation(line=9, column=17)], 'message': 'zero length field name in format'}] = <graphql.core.execution.ExecutionResult object at 0x107a7ead0>.errors | |
tests/core_execution/test_executor.py:111: AssertionError | |
----------------------------- Captured stderr call ----------------------------- | |
graphql-py/.tox/py26/lib/python2.6/site-packages/graphql/core/error.py:41: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6 | |
'message': error.message, | |
_________________________ test_executes_using_a_schema _________________________ | |
def test_executes_using_a_schema(): | |
BlogImage = GraphQLObjectType('BlogImage', { | |
'url': GraphQLField(GraphQLString), | |
'width': GraphQLField(GraphQLInt), | |
'height': GraphQLField(GraphQLInt), | |
}) | |
BlogAuthor = GraphQLObjectType('Author', lambda: { | |
'id': GraphQLField(GraphQLString), | |
'name': GraphQLField(GraphQLString), | |
'pic': GraphQLField(BlogImage, | |
args={ | |
'width': GraphQLArgument(GraphQLInt), | |
'height': GraphQLArgument(GraphQLInt), | |
}, | |
resolver=lambda obj, args, *_: | |
obj.pic(args['width'], args['height']) | |
), | |
'recentArticle': GraphQLField(BlogArticle), | |
}) | |
BlogArticle = GraphQLObjectType('Article', { | |
'id': GraphQLField(GraphQLNonNull(GraphQLString)), | |
'isPublished': GraphQLField(GraphQLBoolean), | |
'author': GraphQLField(BlogAuthor), | |
'title': GraphQLField(GraphQLString), | |
'body': GraphQLField(GraphQLString), | |
'keywords': GraphQLField(GraphQLList(GraphQLString)), | |
}) | |
BlogQuery = GraphQLObjectType('Query', { | |
'article': GraphQLField( | |
BlogArticle, | |
args={'id': GraphQLArgument(GraphQLID)}, | |
resolver=lambda obj, args, *_: Article(args['id'])), | |
'feed': GraphQLField( | |
GraphQLList(BlogArticle), | |
resolver=lambda *_: map(Article, range(1, 10 + 1))), | |
}) | |
BlogSchema = GraphQLSchema(BlogQuery) | |
class Article(object): | |
def __init__(self, id): | |
self.id = id | |
self.isPublished = True | |
self.author = Author() | |
self.title = 'My Article {}'.format(id) | |
self.body = 'This is a post' | |
self.hidden = 'This data is not exposed in the schema' | |
self.keywords = ['foo', 'bar', 1, True, None] | |
class Author(object): | |
id = 123 | |
name = 'John Smith' | |
def pic(self, width, height): | |
return Pic(123, width, height) | |
@property | |
def recentArticle(self): return Article(1) | |
class Pic(object): | |
def __init__(self, uid, width, height): | |
self.url = 'cdn://{}'.format(uid) | |
self.width = str(width) | |
self.height = str(height) | |
request = ''' | |
{ | |
feed { | |
id, | |
title | |
}, | |
article(id: "1") { | |
...articleFields, | |
author { | |
id, | |
name, | |
pic(width: 640, height: 480) { | |
url, | |
width, | |
height | |
}, | |
recentArticle { | |
...articleFields, | |
keywords | |
} | |
} | |
} | |
} | |
fragment articleFields on Article { | |
id, | |
isPublished, | |
title, | |
body, | |
hidden, | |
notdefined | |
} | |
''' | |
# Note: this is intentionally not validating to ensure appropriate | |
# behavior occurs when executing an invalid query. | |
result = execute(BlogSchema, None, parse(request)) | |
> assert not result.errors | |
E assert not [{'locations': [SourceLocation(line=7, column=9)], 'message': 'zero length field name in format'}, {'locations': [SourceLocation(line=3, column=9)], 'message': 'zero length field name in format'}] | |
E + where [{'locations': [SourceLocation(line=7, column=9)], 'message': 'zero length field name in format'}, {'locations': [SourceLocation(line=3, column=9)], 'message': 'zero length field name in format'}] = <graphql.core.execution.ExecutionResult object at 0x107a9a810>.errors | |
tests/core_execution/test_executor_schema.py:118: AssertionError | |
___________________ test_errors_on_null_for_nested_non_null ____________________ | |
def test_errors_on_null_for_nested_non_null(): | |
doc = ''' | |
query q($input:TestInputObject) { | |
fieldWithObjectInput(input: $input) | |
} | |
''' | |
params = {'input': {'a': 'foo', 'b': 'bar', 'c': None}} | |
ast = parse(doc) | |
with raises(GraphQLError) as excinfo: | |
> execute(schema, None, ast, None, params) | |
tests/core_execution/test_variables.py:156: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:102: in execute | |
ctx = ExecutionContext(schema, root, ast, operation_name, args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:79: in __init__ | |
variables = get_variable_values(schema, operation.variable_definitions or [], args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:20: in get_variable_values | |
value = get_variable_value(schema, def_ast, inputs.get(var_name)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
schema = <graphql.core.type.schema.GraphQLSchema object at 0x1079640d0> | |
definition_ast = VariableDefinition(loc={'start': 13, 'source': <graphql.core.language.source.S...ect at 0x107aaf690>, 'end': 35}, value='TestInputObject')), default_value=None) | |
input = {'a': 'foo', 'b': 'bar', 'c': None} | |
def get_variable_value(schema, definition_ast, input): | |
"""Given a variable definition, and any value of input, return a value which adheres to the variable definition, or throw an error.""" | |
type = type_from_ast(schema, definition_ast.type) | |
if not type or not is_input_type(type): | |
raise GraphQLError( | |
'Variable ${} expected value of type {} which cannot be used as an input type.'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
), | |
[definition_ast] | |
) | |
if is_valid_value(type, input): | |
if is_nullish(input): | |
default_value = definition_ast.default_value | |
if default_value: | |
return coerce_value_ast(type, default_value, None) | |
return coerce_value(type, input) | |
raise GraphQLError( | |
'Variable ${} expected value of type {} but got: {}'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
> repr(input) | |
), | |
[definition_ast] | |
) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:70: ValueError | |
________________________ test_errors_on_incorrect_type _________________________ | |
def test_errors_on_incorrect_type(): | |
doc = ''' | |
query q($input:TestInputObject) { | |
fieldWithObjectInput(input: $input) | |
} | |
''' | |
params = {'input': 'foo bar'} | |
ast = parse(doc) | |
with raises(GraphQLError) as excinfo: | |
> execute(schema, None, ast, None, params) | |
tests/core_execution/test_variables.py:170: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:102: in execute | |
ctx = ExecutionContext(schema, root, ast, operation_name, args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:79: in __init__ | |
variables = get_variable_values(schema, operation.variable_definitions or [], args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:20: in get_variable_values | |
value = get_variable_value(schema, def_ast, inputs.get(var_name)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
schema = <graphql.core.type.schema.GraphQLSchema object at 0x1079640d0> | |
definition_ast = VariableDefinition(loc={'start': 13, 'source': <graphql.core.language.source.S...ect at 0x1077c7fd0>, 'end': 35}, value='TestInputObject')), default_value=None) | |
input = 'foo bar' | |
def get_variable_value(schema, definition_ast, input): | |
"""Given a variable definition, and any value of input, return a value which adheres to the variable definition, or throw an error.""" | |
type = type_from_ast(schema, definition_ast.type) | |
if not type or not is_input_type(type): | |
raise GraphQLError( | |
'Variable ${} expected value of type {} which cannot be used as an input type.'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
), | |
[definition_ast] | |
) | |
if is_valid_value(type, input): | |
if is_nullish(input): | |
default_value = definition_ast.default_value | |
if default_value: | |
return coerce_value_ast(type, default_value, None) | |
return coerce_value(type, input) | |
raise GraphQLError( | |
'Variable ${} expected value of type {} but got: {}'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
> repr(input) | |
), | |
[definition_ast] | |
) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:70: ValueError | |
__________________ test_errors_on_omission_of_nested_non_null __________________ | |
def test_errors_on_omission_of_nested_non_null(): | |
doc = ''' | |
query q($input:TestInputObject) { | |
fieldWithObjectInput(input: $input) | |
} | |
''' | |
params = {'input': {'a': 'foo', 'b': 'bar'}} | |
ast = parse(doc) | |
with raises(GraphQLError) as excinfo: | |
> execute(schema, None, ast, None, params) | |
tests/core_execution/test_variables.py:184: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:102: in execute | |
ctx = ExecutionContext(schema, root, ast, operation_name, args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:79: in __init__ | |
variables = get_variable_values(schema, operation.variable_definitions or [], args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:20: in get_variable_values | |
value = get_variable_value(schema, def_ast, inputs.get(var_name)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
schema = <graphql.core.type.schema.GraphQLSchema object at 0x1079640d0> | |
definition_ast = VariableDefinition(loc={'start': 13, 'source': <graphql.core.language.source.S...ect at 0x1077f0f10>, 'end': 35}, value='TestInputObject')), default_value=None) | |
input = {'a': 'foo', 'b': 'bar'} | |
def get_variable_value(schema, definition_ast, input): | |
"""Given a variable definition, and any value of input, return a value which adheres to the variable definition, or throw an error.""" | |
type = type_from_ast(schema, definition_ast.type) | |
if not type or not is_input_type(type): | |
raise GraphQLError( | |
'Variable ${} expected value of type {} which cannot be used as an input type.'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
), | |
[definition_ast] | |
) | |
if is_valid_value(type, input): | |
if is_nullish(input): | |
default_value = definition_ast.default_value | |
if default_value: | |
return coerce_value_ast(type, default_value, None) | |
return coerce_value(type, input) | |
raise GraphQLError( | |
'Variable ${} expected value of type {} but got: {}'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
> repr(input) | |
), | |
[definition_ast] | |
) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:70: ValueError | |
________________ test_errors_on_addition_of_unknown_input_field ________________ | |
def test_errors_on_addition_of_unknown_input_field(): | |
doc = ''' | |
query q($input:TestInputObject) { | |
fieldWithObjectInput(input: $input) | |
} | |
''' | |
params = {'input': {'a': 'foo', 'b': 'bar', 'c': 'baz', 'd': 'dog'}} | |
ast = parse(doc) | |
with raises(GraphQLError) as excinfo: | |
> execute(schema, None, ast, None, params) | |
tests/core_execution/test_variables.py:198: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:102: in execute | |
ctx = ExecutionContext(schema, root, ast, operation_name, args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:79: in __init__ | |
variables = get_variable_values(schema, operation.variable_definitions or [], args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:20: in get_variable_values | |
value = get_variable_value(schema, def_ast, inputs.get(var_name)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
schema = <graphql.core.type.schema.GraphQLSchema object at 0x1079640d0> | |
definition_ast = VariableDefinition(loc={'start': 13, 'source': <graphql.core.language.source.S...ect at 0x107a9a350>, 'end': 35}, value='TestInputObject')), default_value=None) | |
input = {'a': 'foo', 'b': 'bar', 'c': 'baz', 'd': 'dog'} | |
def get_variable_value(schema, definition_ast, input): | |
"""Given a variable definition, and any value of input, return a value which adheres to the variable definition, or throw an error.""" | |
type = type_from_ast(schema, definition_ast.type) | |
if not type or not is_input_type(type): | |
raise GraphQLError( | |
'Variable ${} expected value of type {} which cannot be used as an input type.'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
), | |
[definition_ast] | |
) | |
if is_valid_value(type, input): | |
if is_nullish(input): | |
default_value = definition_ast.default_value | |
if default_value: | |
return coerce_value_ast(type, default_value, None) | |
return coerce_value(type, input) | |
raise GraphQLError( | |
'Variable ${} expected value of type {} but got: {}'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
> repr(input) | |
), | |
[definition_ast] | |
) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:70: ValueError | |
_____ test_does_not_allow_non_nullable_inputs_to_be_omitted_in_a_variable ______ | |
def test_does_not_allow_non_nullable_inputs_to_be_omitted_in_a_variable(): | |
doc = ''' | |
query SetsNonNullable($value: String!) { | |
fieldWithNonNullableStringInput(input: $value) | |
} | |
''' | |
ast = parse(doc) | |
with raises(GraphQLError) as excinfo: | |
> execute(schema, None, ast) | |
tests/core_execution/test_variables.py:306: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:102: in execute | |
ctx = ExecutionContext(schema, root, ast, operation_name, args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:79: in __init__ | |
variables = get_variable_values(schema, operation.variable_definitions or [], args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:20: in get_variable_values | |
value = get_variable_value(schema, def_ast, inputs.get(var_name)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
schema = <graphql.core.type.schema.GraphQLSchema object at 0x1079640d0> | |
definition_ast = VariableDefinition(loc={'start': 31, 'source': <graphql.core.language.source.S...urce object at 0x1077ccd10>, 'end': 45}, value='String'))), default_value=None) | |
input = None | |
def get_variable_value(schema, definition_ast, input): | |
"""Given a variable definition, and any value of input, return a value which adheres to the variable definition, or throw an error.""" | |
type = type_from_ast(schema, definition_ast.type) | |
if not type or not is_input_type(type): | |
raise GraphQLError( | |
'Variable ${} expected value of type {} which cannot be used as an input type.'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
), | |
[definition_ast] | |
) | |
if is_valid_value(type, input): | |
if is_nullish(input): | |
default_value = definition_ast.default_value | |
if default_value: | |
return coerce_value_ast(type, default_value, None) | |
return coerce_value(type, input) | |
raise GraphQLError( | |
'Variable ${} expected value of type {} but got: {}'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
> repr(input) | |
), | |
[definition_ast] | |
) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:70: ValueError | |
___ test_does_not_allow_non_nullable_inputs_to_be_set_to_null_in_a_variable ____ | |
def test_does_not_allow_non_nullable_inputs_to_be_set_to_null_in_a_variable(): | |
doc = ''' | |
query SetsNonNullable($value: String!) { | |
fieldWithNonNullableStringInput(input: $value) | |
} | |
''' | |
ast = parse(doc) | |
with raises(GraphQLError) as excinfo: | |
> execute(schema, None, ast, None, {'value': None}) | |
tests/core_execution/test_variables.py:319: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:102: in execute | |
ctx = ExecutionContext(schema, root, ast, operation_name, args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:79: in __init__ | |
variables = get_variable_values(schema, operation.variable_definitions or [], args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:20: in get_variable_values | |
value = get_variable_value(schema, def_ast, inputs.get(var_name)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
schema = <graphql.core.type.schema.GraphQLSchema object at 0x1079640d0> | |
definition_ast = VariableDefinition(loc={'start': 31, 'source': <graphql.core.language.source.S...urce object at 0x1077eb450>, 'end': 45}, value='String'))), default_value=None) | |
input = None | |
def get_variable_value(schema, definition_ast, input): | |
"""Given a variable definition, and any value of input, return a value which adheres to the variable definition, or throw an error.""" | |
type = type_from_ast(schema, definition_ast.type) | |
if not type or not is_input_type(type): | |
raise GraphQLError( | |
'Variable ${} expected value of type {} which cannot be used as an input type.'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
), | |
[definition_ast] | |
) | |
if is_valid_value(type, input): | |
if is_nullish(input): | |
default_value = definition_ast.default_value | |
if default_value: | |
return coerce_value_ast(type, default_value, None) | |
return coerce_value(type, input) | |
raise GraphQLError( | |
'Variable ${} expected value of type {} but got: {}'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
> repr(input) | |
), | |
[definition_ast] | |
) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:70: ValueError | |
________________ test_does_not_allow_non_null_lists_to_be_null _________________ | |
def test_does_not_allow_non_null_lists_to_be_null(): | |
doc = ''' | |
query q($input:[String]!) { | |
nnList(input: $input) | |
} | |
''' | |
ast = parse(doc) | |
with raises(GraphQLError) as excinfo: | |
> execute(schema, None, ast, None, {'input': None}) | |
tests/core_execution/test_variables.py:409: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:102: in execute | |
ctx = ExecutionContext(schema, root, ast, operation_name, args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:79: in __init__ | |
variables = get_variable_values(schema, operation.variable_definitions or [], args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:20: in get_variable_values | |
value = get_variable_value(schema, def_ast, inputs.get(var_name)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
schema = <graphql.core.type.schema.GraphQLSchema object at 0x1079640d0> | |
definition_ast = VariableDefinition(loc={'start': 17, 'source': <graphql.core.language.source.S...rce object at 0x107a9a690>, 'end': 31}, value='String')))), default_value=None) | |
input = None | |
def get_variable_value(schema, definition_ast, input): | |
"""Given a variable definition, and any value of input, return a value which adheres to the variable definition, or throw an error.""" | |
type = type_from_ast(schema, definition_ast.type) | |
if not type or not is_input_type(type): | |
raise GraphQLError( | |
'Variable ${} expected value of type {} which cannot be used as an input type.'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
), | |
[definition_ast] | |
) | |
if is_valid_value(type, input): | |
if is_nullish(input): | |
default_value = definition_ast.default_value | |
if default_value: | |
return coerce_value_ast(type, default_value, None) | |
return coerce_value(type, input) | |
raise GraphQLError( | |
'Variable ${} expected value of type {} but got: {}'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
> repr(input) | |
), | |
[definition_ast] | |
) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:70: ValueError | |
____________ test_does_not_allow_lists_of_non_nulls_to_contain_null ____________ | |
def test_does_not_allow_lists_of_non_nulls_to_contain_null(): | |
doc = ''' | |
query q($input:[String!]) { | |
listNN(input: $input) | |
} | |
''' | |
ast = parse(doc) | |
with raises(GraphQLError) as excinfo: | |
> execute(schema, None, ast, None, {'input': ['A', None, 'B']}) | |
tests/core_execution/test_variables.py:470: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:102: in execute | |
ctx = ExecutionContext(schema, root, ast, operation_name, args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:79: in __init__ | |
variables = get_variable_values(schema, operation.variable_definitions or [], args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:20: in get_variable_values | |
value = get_variable_value(schema, def_ast, inputs.get(var_name)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
schema = <graphql.core.type.schema.GraphQLSchema object at 0x1079640d0> | |
definition_ast = VariableDefinition(loc={'start': 17, 'source': <graphql.core.language.source.S...rce object at 0x107aa59d0>, 'end': 31}, value='String')))), default_value=None) | |
input = ['A', None, 'B'] | |
def get_variable_value(schema, definition_ast, input): | |
"""Given a variable definition, and any value of input, return a value which adheres to the variable definition, or throw an error.""" | |
type = type_from_ast(schema, definition_ast.type) | |
if not type or not is_input_type(type): | |
raise GraphQLError( | |
'Variable ${} expected value of type {} which cannot be used as an input type.'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
), | |
[definition_ast] | |
) | |
if is_valid_value(type, input): | |
if is_nullish(input): | |
default_value = definition_ast.default_value | |
if default_value: | |
return coerce_value_ast(type, default_value, None) | |
return coerce_value(type, input) | |
raise GraphQLError( | |
'Variable ${} expected value of type {} but got: {}'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
> repr(input) | |
), | |
[definition_ast] | |
) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:70: ValueError | |
__________ test_does_not_allow_non_null_lists_of_non_nulls_to_be_null __________ | |
def test_does_not_allow_non_null_lists_of_non_nulls_to_be_null(): | |
doc = ''' | |
query q($input:[String!]!) { | |
nnListNN(input: $input) | |
} | |
''' | |
ast = parse(doc) | |
with raises(GraphQLError) as excinfo: | |
> execute(schema, None, ast, None, {'input': None}) | |
tests/core_execution/test_variables.py:483: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:102: in execute | |
ctx = ExecutionContext(schema, root, ast, operation_name, args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:79: in __init__ | |
variables = get_variable_values(schema, operation.variable_definitions or [], args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:20: in get_variable_values | |
value = get_variable_value(schema, def_ast, inputs.get(var_name)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
schema = <graphql.core.type.schema.GraphQLSchema object at 0x1079640d0> | |
definition_ast = VariableDefinition(loc={'start': 17, 'source': <graphql.core.language.source.S...ce object at 0x107a7ec10>, 'end': 31}, value='String'))))), default_value=None) | |
input = None | |
def get_variable_value(schema, definition_ast, input): | |
"""Given a variable definition, and any value of input, return a value which adheres to the variable definition, or throw an error.""" | |
type = type_from_ast(schema, definition_ast.type) | |
if not type or not is_input_type(type): | |
raise GraphQLError( | |
'Variable ${} expected value of type {} which cannot be used as an input type.'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
), | |
[definition_ast] | |
) | |
if is_valid_value(type, input): | |
if is_nullish(input): | |
default_value = definition_ast.default_value | |
if default_value: | |
return coerce_value_ast(type, default_value, None) | |
return coerce_value(type, input) | |
raise GraphQLError( | |
'Variable ${} expected value of type {} but got: {}'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
> repr(input) | |
), | |
[definition_ast] | |
) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:70: ValueError | |
_______ test_does_not_allow_non_null_lists_of_non_nulls_to_contain_null ________ | |
def test_does_not_allow_non_null_lists_of_non_nulls_to_contain_null(): | |
doc = ''' | |
query q($input:[String!]!) { | |
nnListNN(input: $input) | |
} | |
''' | |
ast = parse(doc) | |
with raises(GraphQLError) as excinfo: | |
> execute(schema, None, ast, None, {'input': ['A', None, 'B']}) | |
tests/core_execution/test_variables.py:508: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:102: in execute | |
ctx = ExecutionContext(schema, root, ast, operation_name, args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:79: in __init__ | |
variables = get_variable_values(schema, operation.variable_definitions or [], args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:20: in get_variable_values | |
value = get_variable_value(schema, def_ast, inputs.get(var_name)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
schema = <graphql.core.type.schema.GraphQLSchema object at 0x1079640d0> | |
definition_ast = VariableDefinition(loc={'start': 17, 'source': <graphql.core.language.source.S...ce object at 0x1077cc510>, 'end': 31}, value='String'))))), default_value=None) | |
input = ['A', None, 'B'] | |
def get_variable_value(schema, definition_ast, input): | |
"""Given a variable definition, and any value of input, return a value which adheres to the variable definition, or throw an error.""" | |
type = type_from_ast(schema, definition_ast.type) | |
if not type or not is_input_type(type): | |
raise GraphQLError( | |
'Variable ${} expected value of type {} which cannot be used as an input type.'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
), | |
[definition_ast] | |
) | |
if is_valid_value(type, input): | |
if is_nullish(input): | |
default_value = definition_ast.default_value | |
if default_value: | |
return coerce_value_ast(type, default_value, None) | |
return coerce_value(type, input) | |
raise GraphQLError( | |
'Variable ${} expected value of type {} but got: {}'.format( | |
definition_ast.variable.name.value, | |
print_ast(definition_ast.type), | |
> repr(input) | |
), | |
[definition_ast] | |
) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:70: ValueError | |
____________ test_does_not_allow_invalid_types_to_be_used_as_values ____________ | |
def test_does_not_allow_invalid_types_to_be_used_as_values(): | |
doc = ''' | |
query q($input: TestType!) { | |
fieldWithObjectInput(input: $input) | |
} | |
''' | |
ast = parse(doc) | |
with raises(GraphQLError) as excinfo: | |
> execute(schema, None, ast) | |
tests/core_execution/test_variables.py:521: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:102: in execute | |
ctx = ExecutionContext(schema, root, ast, operation_name, args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:79: in __init__ | |
variables = get_variable_values(schema, operation.variable_definitions or [], args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:20: in get_variable_values | |
value = get_variable_value(schema, def_ast, inputs.get(var_name)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
schema = <graphql.core.type.schema.GraphQLSchema object at 0x1079640d0> | |
definition_ast = VariableDefinition(loc={'start': 17, 'source': <graphql.core.language.source.S...ce object at 0x1077f0590>, 'end': 33}, value='TestType'))), default_value=None) | |
input = None | |
def get_variable_value(schema, definition_ast, input): | |
"""Given a variable definition, and any value of input, return a value which adheres to the variable definition, or throw an error.""" | |
type = type_from_ast(schema, definition_ast.type) | |
if not type or not is_input_type(type): | |
raise GraphQLError( | |
'Variable ${} expected value of type {} which cannot be used as an input type.'.format( | |
definition_ast.variable.name.value, | |
> print_ast(definition_ast.type), | |
), | |
[definition_ast] | |
) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:56: ValueError | |
____________ test_does_not_allow_unknown_types_to_be_used_as_values ____________ | |
def test_does_not_allow_unknown_types_to_be_used_as_values(): | |
doc = ''' | |
query q($input: UnknownType!) { | |
fieldWithObjectInput(input: $input) | |
} | |
''' | |
ast = parse(doc) | |
with raises(GraphQLError) as excinfo: | |
> execute(schema, None, ast) | |
tests/core_execution/test_variables.py:534: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:102: in execute | |
ctx = ExecutionContext(schema, root, ast, operation_name, args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/__init__.py:79: in __init__ | |
variables = get_variable_values(schema, operation.variable_definitions or [], args) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:20: in get_variable_values | |
value = get_variable_value(schema, def_ast, inputs.get(var_name)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
schema = <graphql.core.type.schema.GraphQLSchema object at 0x1079640d0> | |
definition_ast = VariableDefinition(loc={'start': 17, 'source': <graphql.core.language.source.S...object at 0x107a8b050>, 'end': 36}, value='UnknownType'))), default_value=None) | |
input = None | |
def get_variable_value(schema, definition_ast, input): | |
"""Given a variable definition, and any value of input, return a value which adheres to the variable definition, or throw an error.""" | |
type = type_from_ast(schema, definition_ast.type) | |
if not type or not is_input_type(type): | |
raise GraphQLError( | |
'Variable ${} expected value of type {} which cannot be used as an input type.'.format( | |
definition_ast.variable.name.value, | |
> print_ast(definition_ast.type), | |
), | |
[definition_ast] | |
) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/execution/values.py:56: ValueError | |
________________________ test_errors_respect_whitespace ________________________ | |
def test_errors_respect_whitespace(): | |
with raises(LanguageError) as excinfo: | |
lex_one(""" | |
? | |
> """) | |
tests/core_language/test_lexer.py:33: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_language/test_lexer.py:7: in lex_one | |
return Lexer(Source(s)).next_token() | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/lexer.py:37: in next_token | |
token = read_token(self.source, reset_position) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
source = <graphql.core.language.source.Source object at 0x1077d9090> | |
from_position = 0 | |
def read_token(source, from_position): | |
"""Gets the next token from the source starting at the given position. | |
This skips over whitespace and comments until it finds the next lexable | |
token, then lexes punctuators immediately or calls the appropriate | |
helper fucntion for more complicated tokens.""" | |
body = source.body | |
body_length = len(body) | |
position = position_after_whitespace(body, from_position) | |
code = char_code_at(body, position) | |
if position >= body_length: | |
return Token(TokenKind.EOF, position, position) | |
kind = PUNCT_CODE_TO_KIND.get(code) | |
if kind is not None: | |
return Token(kind, position, position + 1) | |
if code == 46: # . | |
if char_code_at(body, position + 1) == 46 and \ | |
char_code_at(body, position + 2) == 46: | |
return Token(TokenKind.SPREAD, position, position + 3) | |
elif 65 <= code <= 90 or code == 95 or 97 <= code <= 122: | |
# A-Z, _, a-z | |
return read_name(source, position) | |
elif code == 45 or 48 <= code <= 57: # -, 0-9 | |
return read_number(source, position, code) | |
elif code == 34: # " | |
return read_string(source, position) | |
raise LanguageError( | |
source, position, | |
> u'Unexpected character "{}"'.format(body[position])) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/lexer.py:156: ValueError | |
____________________ test_lex_reports_useful_string_errors _____________________ | |
def test_lex_reports_useful_string_errors(): | |
with raises(LanguageError) as excinfo: | |
lex_one('"no end quote') | |
> assert 'Syntax Error GraphQL (1:14) Unterminated string' in str(excinfo.value) | |
tests/core_language/test_lexer.py:55: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/error.py:15: in __str__ | |
return unicode(self).encode(errors='replace') | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/error.py:24: in __unicode__ | |
highlight_source_at_location(self.source, location), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
source = <graphql.core.language.source.Source object at 0x1077fc390> | |
location = SourceLocation(line=1, column=14) | |
def highlight_source_at_location(source, location): | |
line = location.line | |
lines = source.body.splitlines() | |
pad_len = len(str(line + 1)) | |
result = u'' | |
format = (u'{:>' + str(pad_len) + '}: {}\n').format | |
if line >= 2: | |
result += format(line - 1, lines[line - 2]) | |
> result += format(line, lines[line - 1]) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/error.py:36: ValueError | |
____________________ test_lex_reports_useful_number_errors _____________________ | |
def test_lex_reports_useful_number_errors(): | |
with raises(LanguageError) as excinfo: | |
> lex_one('+1') | |
tests/core_language/test_lexer.py:118: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_language/test_lexer.py:7: in lex_one | |
return Lexer(Source(s)).next_token() | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/lexer.py:37: in next_token | |
token = read_token(self.source, reset_position) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
source = <graphql.core.language.source.Source object at 0x1077f95d0> | |
from_position = 0 | |
def read_token(source, from_position): | |
"""Gets the next token from the source starting at the given position. | |
This skips over whitespace and comments until it finds the next lexable | |
token, then lexes punctuators immediately or calls the appropriate | |
helper fucntion for more complicated tokens.""" | |
body = source.body | |
body_length = len(body) | |
position = position_after_whitespace(body, from_position) | |
code = char_code_at(body, position) | |
if position >= body_length: | |
return Token(TokenKind.EOF, position, position) | |
kind = PUNCT_CODE_TO_KIND.get(code) | |
if kind is not None: | |
return Token(kind, position, position + 1) | |
if code == 46: # . | |
if char_code_at(body, position + 1) == 46 and \ | |
char_code_at(body, position + 2) == 46: | |
return Token(TokenKind.SPREAD, position, position + 3) | |
elif 65 <= code <= 90 or code == 95 or 97 <= code <= 122: | |
# A-Z, _, a-z | |
return read_name(source, position) | |
elif code == 45 or 48 <= code <= 57: # -, 0-9 | |
return read_number(source, position, code) | |
elif code == 34: # " | |
return read_string(source, position) | |
raise LanguageError( | |
source, position, | |
> u'Unexpected character "{}"'.format(body[position])) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/lexer.py:156: ValueError | |
_______________ test_lex_reports_useful_unknown_character_error ________________ | |
def test_lex_reports_useful_unknown_character_error(): | |
with raises(LanguageError) as excinfo: | |
> lex_one('..') | |
tests/core_language/test_lexer.py:164: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_language/test_lexer.py:7: in lex_one | |
return Lexer(Source(s)).next_token() | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/lexer.py:37: in next_token | |
token = read_token(self.source, reset_position) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
source = <graphql.core.language.source.Source object at 0x1077d9290> | |
from_position = 0 | |
def read_token(source, from_position): | |
"""Gets the next token from the source starting at the given position. | |
This skips over whitespace and comments until it finds the next lexable | |
token, then lexes punctuators immediately or calls the appropriate | |
helper fucntion for more complicated tokens.""" | |
body = source.body | |
body_length = len(body) | |
position = position_after_whitespace(body, from_position) | |
code = char_code_at(body, position) | |
if position >= body_length: | |
return Token(TokenKind.EOF, position, position) | |
kind = PUNCT_CODE_TO_KIND.get(code) | |
if kind is not None: | |
return Token(kind, position, position + 1) | |
if code == 46: # . | |
if char_code_at(body, position + 1) == 46 and \ | |
char_code_at(body, position + 2) == 46: | |
return Token(TokenKind.SPREAD, position, position + 3) | |
elif 65 <= code <= 90 or code == 95 or 97 <= code <= 122: | |
# A-Z, _, a-z | |
return read_name(source, position) | |
elif code == 45 or 48 <= code <= 57: # -, 0-9 | |
return read_number(source, position, code) | |
elif code == 34: # " | |
return read_string(source, position) | |
raise LanguageError( | |
source, position, | |
> u'Unexpected character "{}"'.format(body[position])) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/lexer.py:156: ValueError | |
______________________ test_parse_provides_useful_errors _______________________ | |
def test_parse_provides_useful_errors(): | |
with raises(LanguageError) as excinfo: | |
parse("""{ ...MissingOn } | |
fragment MissingOn Type | |
> """) | |
tests/core_language/test_parser.py:13: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:17: in parse | |
return parse_document(parser) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:157: in parse_document | |
definitions.append(parse_fragment_definition(parser)) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:320: in parse_fragment_definition | |
expect_keyword(parser, 'on'), | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:97: in expect_keyword | |
'Expected "{}", found {}'.format(value, get_token_desc(token)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
token = <[ValueError("zero length field name in format") raised in repr()] SafeRepr object at 0x107bcc9e0> | |
def get_token_desc(token): | |
if token.value: | |
return '{} "{}"'.format( | |
get_token_kind_desc(token.kind), | |
> token.value | |
) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/lexer.py:68: ValueError | |
______________ test_parse_provides_useful_error_when_using_source ______________ | |
def test_parse_provides_useful_error_when_using_source(): | |
with raises(LanguageError) as excinfo: | |
> parse(Source('query', 'MyQuery.graphql')) | |
tests/core_language/test_parser.py:31: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:17: in parse | |
return parse_document(parser) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:155: in parse_document | |
definitions.append(parse_operation_definition(parser)) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:187: in parse_operation_definition | |
name=parse_name(parser), | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:138: in parse_name | |
token = expect(parser, TokenKind.NAME) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
parser = <graphql.core.language.parser.Parser object at 0x1077d86d0>, kind = 15 | |
def expect(parser, kind): | |
"""If the next token is of the given kind, return that token after | |
advancing the parser. Otherwise, do not change the parser state and | |
return False.""" | |
token = parser.token | |
if token.kind == kind: | |
advance(parser) | |
return token | |
raise LanguageError( | |
parser.source, | |
token.start, | |
'Expected {}, found {}'.format( | |
get_token_kind_desc(kind), | |
> get_token_desc(token) | |
) | |
) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:81: ValueError | |
_____________________ test_parses_constant_default_values ______________________ | |
def test_parses_constant_default_values(): | |
with raises(LanguageError) as excinfo: | |
> parse('query Foo($x: Complex = { a: { b: [ $var ] } }) { field }') | |
tests/core_language/test_parser.py:41: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:17: in parse | |
return parse_document(parser) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:155: in parse_document | |
definitions.append(parse_operation_definition(parser)) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:188: in parse_operation_definition | |
variable_definitions=parse_variable_definitions(parser), | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:201: in parse_variable_definitions | |
TokenKind.PAREN_R | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:130: in many | |
nodes = [parse_fn(parser)] | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:211: in parse_variable_definition | |
default_value = parse_value(parser, True) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:343: in parse_value | |
return parse_object(parser, is_const) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:384: in parse_object | |
fields.append(parse_object_field(parser, is_const, field_names)) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:402: in parse_object_field | |
parse_value(parser, is_const))[1], | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:343: in parse_value | |
return parse_object(parser, is_const) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:384: in parse_object | |
fields.append(parse_object_field(parser, is_const, field_names)) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:402: in parse_object_field | |
parse_value(parser, is_const))[1], | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:341: in parse_value | |
return parse_array(parser, is_const) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:373: in parse_array | |
item, TokenKind.BRACKET_R), | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:120: in any | |
nodes.append(parse_fn(parser)) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:335: in parse_const_value | |
return parse_value(parser, True) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:361: in parse_value | |
raise unexpected(parser) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
parser = <graphql.core.language.parser.Parser object at 0x1077df550> | |
at_token = None | |
def unexpected(parser, at_token=None): | |
"""Helper function for creating an error when an unexpected lexed token | |
is encountered.""" | |
token = at_token or parser.token | |
return LanguageError( | |
parser.source, | |
token.start, | |
> 'Unexpected {}'.format(get_token_desc(token)) | |
) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:108: ValueError | |
_____________ test_duplicate_keys_in_input_object_is_syntax_error ______________ | |
def test_duplicate_keys_in_input_object_is_syntax_error(): | |
with raises(LanguageError) as excinfo: | |
> parse('{ field(arg: { a: 1, a: 2 }) }') | |
tests/core_language/test_parser.py:47: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:17: in parse | |
return parse_document(parser) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:152: in parse_document | |
definitions.append(parse_operation_definition(parser)) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:180: in parse_operation_definition | |
selection_set=parse_selection_set(parser), | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:234: in parse_selection_set | |
selections=many(parser, TokenKind.BRACE_L, parse_selection, TokenKind.BRACE_R), | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:130: in many | |
nodes = [parse_fn(parser)] | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:243: in parse_selection | |
return parse_field(parser) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:258: in parse_field | |
arguments = parse_arguments(parser) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:278: in parse_arguments | |
parse_argument, TokenKind.PAREN_R) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:130: in many | |
nodes = [parse_fn(parser)] | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:288: in parse_argument | |
parse_value(parser, False))[1], | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:343: in parse_value | |
return parse_object(parser, is_const) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:384: in parse_object | |
fields.append(parse_object_field(parser, is_const, field_names)) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
parser = <graphql.core.language.parser.Parser object at 0x1077f9990> | |
is_const = False, field_names = set(['a']) | |
def parse_object_field(parser, is_const, field_names): | |
start = parser.token.start | |
name = parse_name(parser) | |
if name.value in field_names: | |
raise LanguageError( | |
parser.source, | |
start, | |
> "Duplicate input object field {}.".format(name.value) | |
) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/parser.py:395: ValueError | |
___________________________ test_does_not_alter_ast ____________________________ | |
def test_does_not_alter_ast(): | |
ast = parse(KITCHEN_SINK) | |
ast_copy = copy.deepcopy(ast) | |
> print_ast(ast) | |
tests/core_language/test_printer.py:12: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/printer.py:8: in print_ast | |
return visit(ast, PrintingVisitor()) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:106: in visit | |
result = visitor.leave(node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:157: in leave | |
return self._call_kind_specific_visitor('leave_', node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:164: in _call_kind_specific_visitor | |
return method(node, key, parent, path, ancestors) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <graphql.core.language.printer.PrintingVisitor object at 0x107bd1710> | |
node = FragmentDefinition(loc={'start': 661, 'source': <graphql.core.language.source....ves=[], selection_set='{\n foo(size: $size, bar: $b, obj: {key: "value"})\n}') | |
args = (2, [OperationDefinition(loc={'start': 289, 'source': <graphql.core.language.source...ject at 0x107bd1310>, 'end': 546...hql.core.language.source.Source obj...d': 788}, value='query'), arguments=[], directives=[], selection_set=None)]))])]) | |
def leave_FragmentDefinition(self, node, *args): | |
return ('fragment {} on {} '.format(node.name, node.type_condition) + | |
> wrap('', join(node.directives, ' '), ' ') + | |
node.selection_set) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/printer.py:59: ValueError | |
___________________________ test_prints_kitchen_sink ___________________________ | |
def test_prints_kitchen_sink(): | |
ast = parse(KITCHEN_SINK) | |
> printed = print_ast(ast) | |
tests/core_language/test_printer.py:35: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/printer.py:8: in print_ast | |
return visit(ast, PrintingVisitor()) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:106: in visit | |
result = visitor.leave(node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:157: in leave | |
return self._call_kind_specific_visitor('leave_', node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:164: in _call_kind_specific_visitor | |
return method(node, key, parent, path, ancestors) | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
self = <graphql.core.language.printer.PrintingVisitor object at 0x107a8b4d0> | |
node = FragmentDefinition(loc={'start': 661, 'source': <graphql.core.language.source....ves=[], selection_set='{\n foo(size: $size, bar: $b, obj: {key: "value"})\n}') | |
args = (2, [OperationDefinition(loc={'start': 289, 'source': <graphql.core.language.source...ject at 0x107a8b290>, 'end': 546...hql.core.language.source.Source obj...d': 788}, value='query'), arguments=[], directives=[], selection_set=None)]))])]) | |
def leave_FragmentDefinition(self, node, *args): | |
return ('fragment {} on {} '.format(node.name, node.type_condition) + | |
> wrap('', join(node.directives, ' '), ' ') + | |
node.selection_set) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/printer.py:59: ValueError | |
___________________________ test_non_existent_fields ___________________________ | |
def test_non_existent_fields(): | |
query = ''' | |
query HeroSpaceshipQuery { | |
hero { | |
favoriteSpaceship | |
} | |
} | |
''' | |
> assert validation_errors(query) | |
tests/core_starwars/test_validation.py:42: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_starwars/test_validation.py:10: in validation_errors | |
return validate(StarWarsSchema, ast) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/__init__.py:40: in validate | |
return visit_using_rules(schema, ast, rules) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/__init__.py:49: in visit_using_rules | |
visit(ast, ValidationVisitor(instance, type_info, errors)) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:108: in visit | |
result = visitor.enter(node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/__init__.py:65: in enter | |
result = self.instance.enter(node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:154: in enter | |
return self._call_kind_specific_visitor('enter_', node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:164: in _call_kind_specific_visitor | |
return method(node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:141: in enter_Field | |
self.message(node.name.value, type.name), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field_name = 'favoriteSpaceship', type = 'Character' | |
@staticmethod | |
def message(field_name, type): | |
> return 'Cannot query field "{}" on "{}".'.format(field_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:147: ValueError | |
________________________ test_require_fields_on_object _________________________ | |
def test_require_fields_on_object(): | |
query = ''' | |
query HeroNoFieldsQuery { | |
hero | |
} | |
''' | |
> assert validation_errors(query) | |
tests/core_starwars/test_validation.py:51: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_starwars/test_validation.py:10: in validation_errors | |
return validate(StarWarsSchema, ast) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/__init__.py:40: in validate | |
return visit_using_rules(schema, ast, rules) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/__init__.py:49: in visit_using_rules | |
visit(ast, ValidationVisitor(instance, type_info, errors)) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:108: in visit | |
result = visitor.enter(node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/__init__.py:65: in enter | |
result = self.instance.enter(node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:154: in enter | |
return self._call_kind_specific_visitor('enter_', node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:164: in _call_kind_specific_visitor | |
return method(node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:121: in enter_Field | |
self.required_message(node.name.value, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field = 'hero' | |
type = <graphql.core.type.definition.GraphQLInterfaceType object at 0x10767e210> | |
@staticmethod | |
def required_message(field, type): | |
> return 'Field "{}" of type "{}" must have a sub selection.'.format(field, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:131: ValueError | |
_______________________ test_disallows_fields_on_scalars _______________________ | |
def test_disallows_fields_on_scalars(): | |
query = ''' | |
query HeroFieldsOnScalarQuery { | |
hero { | |
name { | |
firstCharacterOfName | |
} | |
} | |
} | |
''' | |
> assert validation_errors(query) | |
tests/core_starwars/test_validation.py:64: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_starwars/test_validation.py:10: in validation_errors | |
return validate(StarWarsSchema, ast) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/__init__.py:40: in validate | |
return visit_using_rules(schema, ast, rules) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/__init__.py:49: in visit_using_rules | |
visit(ast, ValidationVisitor(instance, type_info, errors)) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:108: in visit | |
result = visitor.enter(node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/__init__.py:65: in enter | |
result = self.instance.enter(node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:154: in enter | |
return self._call_kind_specific_visitor('enter_', node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:164: in _call_kind_specific_visitor | |
return method(node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:116: in enter_Field | |
self.not_allowed_message(node.name.value, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field = 'name' | |
type = <graphql.core.type.definition.GraphQLScalarType object at 0x1073eaf90> | |
@staticmethod | |
def not_allowed_message(field, type): | |
> return 'Field "{}" of type "{}" must not have a sub selection.'.format(field, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:127: ValueError | |
__________________ test_disallows_object_fields_on_interfaces __________________ | |
def test_disallows_object_fields_on_interfaces(): | |
query = ''' | |
query DroidFieldOnCharacter { | |
hero { | |
name | |
primaryFunction | |
} | |
} | |
''' | |
> assert validation_errors(query) | |
tests/core_starwars/test_validation.py:76: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_starwars/test_validation.py:10: in validation_errors | |
return validate(StarWarsSchema, ast) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/__init__.py:40: in validate | |
return visit_using_rules(schema, ast, rules) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/__init__.py:49: in visit_using_rules | |
visit(ast, ValidationVisitor(instance, type_info, errors)) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:108: in visit | |
result = visitor.enter(node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/__init__.py:65: in enter | |
result = self.instance.enter(node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:154: in enter | |
return self._call_kind_specific_visitor('enter_', node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/language/visitor.py:164: in _call_kind_specific_visitor | |
return method(node, key, parent, path, ancestors) | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:141: in enter_Field | |
self.message(node.name.value, type.name), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field_name = 'primaryFunction', type = 'Character' | |
@staticmethod | |
def message(field_name, type): | |
> return 'Cannot query field "{}" on "{}".'.format(field_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:147: ValueError | |
______________ test_prohibits_putting_non_object_types_in_unions _______________ | |
def test_prohibits_putting_non_object_types_in_unions(): | |
bad_union_types = [ | |
GraphQLInt, | |
GraphQLNonNull(GraphQLInt), | |
GraphQLList(GraphQLInt), | |
InterfaceType, | |
UnionType, | |
EnumType, | |
InputObjectType | |
] | |
for x in bad_union_types: | |
with raises(Exception) as excinfo: | |
GraphQLUnionType('BadUnion', [x]) | |
> assert 'Union BadUnion may only contain object types, it cannot contain: ' + str(x) + '.' \ | |
== str(excinfo.value) | |
E assert 'Union BadUni...contain: Int.' == 'zero length f...ame in format' | |
E - Union BadUnion may only contain object types, it cannot contain: Int. | |
E + zero length field name in format | |
tests/core_type/test_definition.py:158: AssertionError | |
______________________ test_field_not_defined_on_fragment ______________________ | |
def test_field_not_defined_on_fragment(): | |
expect_fails_rule(FieldsOnCorrectType, ''' | |
fragment fieldNotDefined on Dog { | |
meowVolume | |
} | |
> ''', [error('meowVolume', 'Dog', 3, 9)]) | |
tests/core_validation/test_fields_on_correct_type.py:69: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_fields_on_correct_type.py:8: in error | |
'message': FieldsOnCorrectType.message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field_name = 'meowVolume', type = 'Dog' | |
@staticmethod | |
def message(field_name, type): | |
> return 'Cannot query field "{}" on "{}".'.format(field_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:147: ValueError | |
_______________ test_field_not_defined_deeply_only_reports_first _______________ | |
def test_field_not_defined_deeply_only_reports_first(): | |
expect_fails_rule(FieldsOnCorrectType, ''' | |
fragment deepFieldNotDefined on Dog { | |
unknown_field { | |
deeper_unknown_field | |
} | |
} | |
> ''', [error('unknown_field', 'Dog', 3, 9)]) | |
tests/core_validation/test_fields_on_correct_type.py:79: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_fields_on_correct_type.py:8: in error | |
'message': FieldsOnCorrectType.message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field_name = 'unknown_field', type = 'Dog' | |
@staticmethod | |
def message(field_name, type): | |
> return 'Cannot query field "{}" on "{}".'.format(field_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:147: ValueError | |
__________________________ test_sub_field_not_defined __________________________ | |
def test_sub_field_not_defined(): | |
expect_fails_rule(FieldsOnCorrectType, ''' | |
fragment subFieldNotDefined on Human { | |
pets { | |
unknown_field | |
} | |
} | |
> ''', [error('unknown_field', 'Pet', 4, 11)]) | |
tests/core_validation/test_fields_on_correct_type.py:89: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_fields_on_correct_type.py:8: in error | |
'message': FieldsOnCorrectType.message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field_name = 'unknown_field', type = 'Pet' | |
@staticmethod | |
def message(field_name, type): | |
> return 'Cannot query field "{}" on "{}".'.format(field_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:147: ValueError | |
__________________ test_field_not_defined_on_inline_fragment ___________________ | |
def test_field_not_defined_on_inline_fragment(): | |
expect_fails_rule(FieldsOnCorrectType, ''' | |
fragment fieldNotDefined on Pet { | |
... on Dog { | |
meowVolume | |
} | |
} | |
> ''', [error('meowVolume', 'Dog', 4, 11)]) | |
tests/core_validation/test_fields_on_correct_type.py:99: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_fields_on_correct_type.py:8: in error | |
'message': FieldsOnCorrectType.message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field_name = 'meowVolume', type = 'Dog' | |
@staticmethod | |
def message(field_name, type): | |
> return 'Cannot query field "{}" on "{}".'.format(field_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:147: ValueError | |
____________________ test_aliased_field_target_not_defined _____________________ | |
def test_aliased_field_target_not_defined(): | |
expect_fails_rule(FieldsOnCorrectType, ''' | |
fragment aliasedFieldTargetNotDefined on Dog { | |
volume : mooVolume | |
} | |
> ''', [error('mooVolume', 'Dog', 3, 9)]) | |
tests/core_validation/test_fields_on_correct_type.py:107: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_fields_on_correct_type.py:8: in error | |
'message': FieldsOnCorrectType.message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field_name = 'mooVolume', type = 'Dog' | |
@staticmethod | |
def message(field_name, type): | |
> return 'Cannot query field "{}" on "{}".'.format(field_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:147: ValueError | |
_________________ test_aliased_lying_field_target_not_defined __________________ | |
def test_aliased_lying_field_target_not_defined(): | |
expect_fails_rule(FieldsOnCorrectType, ''' | |
fragment aliasedLyingFieldTargetNotDefined on Dog { | |
barkVolume : kawVolume | |
} | |
> ''', [error('kawVolume', 'Dog', 3, 9)]) | |
tests/core_validation/test_fields_on_correct_type.py:115: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_fields_on_correct_type.py:8: in error | |
'message': FieldsOnCorrectType.message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field_name = 'kawVolume', type = 'Dog' | |
@staticmethod | |
def message(field_name, type): | |
> return 'Cannot query field "{}" on "{}".'.format(field_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:147: ValueError | |
________________________ test_not_defined_on_interface _________________________ | |
def test_not_defined_on_interface(): | |
expect_fails_rule(FieldsOnCorrectType, ''' | |
fragment notDefinedOnInterface on Pet { | |
tailLength | |
} | |
> ''', [error('tailLength', 'Pet', 3, 9)]) | |
tests/core_validation/test_fields_on_correct_type.py:123: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_fields_on_correct_type.py:8: in error | |
'message': FieldsOnCorrectType.message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field_name = 'tailLength', type = 'Pet' | |
@staticmethod | |
def message(field_name, type): | |
> return 'Cannot query field "{}" on "{}".'.format(field_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:147: ValueError | |
______________ test_defined_on_implementors_but_not_on_interface _______________ | |
def test_defined_on_implementors_but_not_on_interface(): | |
expect_fails_rule(FieldsOnCorrectType, ''' | |
fragment definedOnImplementorsButNotInterface on Pet { | |
nickname | |
} | |
> ''', [error('nickname', 'Pet', 3, 9)]) | |
tests/core_validation/test_fields_on_correct_type.py:131: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_fields_on_correct_type.py:8: in error | |
'message': FieldsOnCorrectType.message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field_name = 'nickname', type = 'Pet' | |
@staticmethod | |
def message(field_name, type): | |
> return 'Cannot query field "{}" on "{}".'.format(field_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:147: ValueError | |
_____________________ test_direct_field_selection_on_union _____________________ | |
def test_direct_field_selection_on_union(): | |
expect_fails_rule(FieldsOnCorrectType, ''' | |
fragment directFieldSelectionOnUnion on CatOrDog { | |
directField | |
} | |
> ''', [error('directField', 'CatOrDog', 3, 9)]) | |
tests/core_validation/test_fields_on_correct_type.py:147: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_fields_on_correct_type.py:8: in error | |
'message': FieldsOnCorrectType.message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field_name = 'directField', type = 'CatOrDog' | |
@staticmethod | |
def message(field_name, type): | |
> return 'Cannot query field "{}" on "{}".'.format(field_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:147: ValueError | |
________________ test_defined_on_implementors_queried_on_union _________________ | |
def test_defined_on_implementors_queried_on_union(): | |
expect_fails_rule(FieldsOnCorrectType, ''' | |
fragment definedOnImplementorsQueriedOnUnion on CatOrDog { | |
name | |
} | |
> ''', [error('name', 'CatOrDog', 3, 9)]) | |
tests/core_validation/test_fields_on_correct_type.py:155: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_fields_on_correct_type.py:8: in error | |
'message': FieldsOnCorrectType.message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field_name = 'name', type = 'CatOrDog' | |
@staticmethod | |
def message(field_name, type): | |
> return 'Cannot query field "{}" on "{}".'.format(field_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:147: ValueError | |
_____________________ test_scalar_is_invalid_fragment_type _____________________ | |
def test_scalar_is_invalid_fragment_type(): | |
expect_fails_rule(FragmentsOnCompositeTypes, ''' | |
fragment scalarFragment on Boolean { | |
bad | |
} | |
> ''', [error('scalarFragment', 'Boolean', 2, 34)]) | |
tests/core_validation/test_fragments_on_composite_types.py:52: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_fragments_on_composite_types.py:8: in error | |
'message': FragmentsOnCompositeTypes.message(frag_name, type_name), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
frag_name = 'scalarFragment', type = 'Boolean' | |
@staticmethod | |
def message(frag_name, type): | |
> return 'Fragment "{}" cannot condition on non composite type "{}".'.format(frag_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:90: ValueError | |
______________________ test_enum_is_invalid_fragment_type ______________________ | |
def test_enum_is_invalid_fragment_type(): | |
expect_fails_rule(FragmentsOnCompositeTypes, ''' | |
fragment scalarFragment on FurColor { | |
bad | |
} | |
> ''', [error('scalarFragment', 'FurColor', 2, 34)]) | |
tests/core_validation/test_fragments_on_composite_types.py:60: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_fragments_on_composite_types.py:8: in error | |
'message': FragmentsOnCompositeTypes.message(frag_name, type_name), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
frag_name = 'scalarFragment', type = 'FurColor' | |
@staticmethod | |
def message(frag_name, type): | |
> return 'Fragment "{}" cannot condition on non composite type "{}".'.format(frag_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:90: ValueError | |
__________________ test_input_object_is_invalid_fragment_type __________________ | |
def test_input_object_is_invalid_fragment_type(): | |
expect_fails_rule(FragmentsOnCompositeTypes, ''' | |
fragment inputFragment on ComplexInput { | |
stringField | |
} | |
> ''', [error('inputFragment', 'ComplexInput', 2, 33)]) | |
tests/core_validation/test_fragments_on_composite_types.py:68: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_fragments_on_composite_types.py:8: in error | |
'message': FragmentsOnCompositeTypes.message(frag_name, type_name), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
frag_name = 'inputFragment', type = 'ComplexInput' | |
@staticmethod | |
def message(frag_name, type): | |
> return 'Fragment "{}" cannot condition on non composite type "{}".'.format(frag_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:90: ValueError | |
_________________ test_scalar_is_invalid_inline_fragment_type __________________ | |
def test_scalar_is_invalid_inline_fragment_type(): | |
expect_fails_rule(FragmentsOnCompositeTypes, ''' | |
fragment invalidFragment on Pet { | |
... on String { | |
barks | |
} | |
} | |
''', [{ | |
> 'message': FragmentsOnCompositeTypes.inline_message('String'), | |
'locations': [SourceLocation(3, 16)] | |
}]) | |
tests/core_validation/test_fragments_on_composite_types.py:79: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
type = 'String' | |
@staticmethod | |
def inline_message(type): | |
> return 'Fragment cannot condition on non composite type "{}".'.format(type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:86: ValueError | |
______________________ test_undirective_args_are_invalid _______________________ | |
def test_undirective_args_are_invalid(): | |
expect_fails_rule(KnownArgumentNames, ''' | |
{ | |
dog @skip(unless: true) | |
} | |
> ''', [unknown_directive_arg('unless', 'skip', 3, 19)]) | |
tests/core_validation/test_known_argument_names.py:91: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_known_argument_names.py:16: in unknown_directive_arg | |
arg_name, directive_name), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
arg_name = 'unless', directive_name = 'skip' | |
@staticmethod | |
def directive_message(arg_name, directive_name): | |
> return 'Unknown argument "{}" on directive "@{}".'.format(arg_name, directive_name) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:220: ValueError | |
____________________________ test_invalid_arg_name _____________________________ | |
def test_invalid_arg_name(): | |
expect_fails_rule(KnownArgumentNames, ''' | |
fragment invalidArgName on Dog { | |
doesKnowCommand(unknown: true) | |
} | |
> ''', [unknown_arg('unknown', 'doesKnowCommand', 'Dog', 3, 25)]) | |
tests/core_validation/test_known_argument_names.py:99: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_known_argument_names.py:8: in unknown_arg | |
'message': KnownArgumentNames.message(arg_name, field_name, type_name), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
arg_name = 'unknown', field_name = 'doesKnowCommand', type = 'Dog' | |
@staticmethod | |
def message(arg_name, field_name, type): | |
> return 'Unknown argument "{}" on field "{}" of type "{}".'.format(arg_name, field_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:216: ValueError | |
_____________________ test_unknown_args_amongst_known_args _____________________ | |
def test_unknown_args_amongst_known_args(): | |
expect_fails_rule(KnownArgumentNames, ''' | |
fragment oneGoodArgOneInvalidArg on Dog { | |
doesKnowCommand(whoknows: 1, dogCommand: SIT, unknown: true) | |
} | |
> ''', [unknown_arg('whoknows', 'doesKnowCommand', 'Dog', 3, 25), | |
unknown_arg('unknown', 'doesKnowCommand', 'Dog', 3, 55)]) | |
tests/core_validation/test_known_argument_names.py:107: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_known_argument_names.py:8: in unknown_arg | |
'message': KnownArgumentNames.message(arg_name, field_name, type_name), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
arg_name = 'whoknows', field_name = 'doesKnowCommand', type = 'Dog' | |
@staticmethod | |
def message(arg_name, field_name, type): | |
> return 'Unknown argument "{}" on field "{}" of type "{}".'.format(arg_name, field_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:216: ValueError | |
___________________________ test_unknown_args_deeply ___________________________ | |
def test_unknown_args_deeply(): | |
expect_fails_rule(KnownArgumentNames, ''' | |
{ | |
dog { | |
doesKnowCommand(unknown: true) | |
} | |
human { | |
pet { | |
... on Dog { | |
doesKnowCommand(unknown: true) | |
} | |
} | |
} | |
} | |
> ''', [unknown_arg('unknown', 'doesKnowCommand', 'Dog', 4, 27), | |
unknown_arg('unknown', 'doesKnowCommand', 'Dog', 9, 31)]) | |
tests/core_validation/test_known_argument_names.py:125: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_known_argument_names.py:8: in unknown_arg | |
'message': KnownArgumentNames.message(arg_name, field_name, type_name), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
arg_name = 'unknown', field_name = 'doesKnowCommand', type = 'Dog' | |
@staticmethod | |
def message(arg_name, field_name, type): | |
> return 'Unknown argument "{}" on field "{}" of type "{}".'.format(arg_name, field_name, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:216: ValueError | |
_____________________ test_unknown_type_names_are_invalid ______________________ | |
def test_unknown_type_names_are_invalid(): | |
expect_fails_rule(KnownTypeNames, ''' | |
query Foo($var: JumbledUpLetters) { | |
user(id: 4) { | |
name | |
pets { ... on Badger { name }, ...PetFields } | |
} | |
} | |
fragment PetFields on Peettt { | |
name | |
} | |
''', [ | |
> unknown_type('JumbledUpLetters', 2, 23), | |
unknown_type('Badger', 5, 25), | |
unknown_type('Peettt', 8, 29), | |
]) | |
tests/core_validation/test_known_type_names.py:38: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_known_type_names.py:8: in unknown_type | |
'message': KnownTypeNames.message(type_name), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
type = 'JumbledUpLetters' | |
@staticmethod | |
def message(type): | |
> return 'Unknown type "{}".'.format(type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:64: ValueError | |
______________________ test_object_type_missing_selection ______________________ | |
def test_object_type_missing_selection(): | |
expect_fails_rule(ScalarLeafs, ''' | |
query directQueryOnObjectWithoutSubFields { | |
human | |
} | |
> ''', [missing_obj_subselection('human', 'Human', 3, 9)]) | |
tests/core_validation/test_scalar_leafs.py:33: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_scalar_leafs.py:15: in missing_obj_subselection | |
'message': ScalarLeafs.required_message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field = 'human', type = 'Human' | |
@staticmethod | |
def required_message(field, type): | |
> return 'Field "{}" of type "{}" must have a sub selection.'.format(field, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:131: ValueError | |
____________________ test_interface_type_missing_selection _____________________ | |
def test_interface_type_missing_selection(): | |
expect_fails_rule(ScalarLeafs, ''' | |
{ | |
human { pets } | |
} | |
> ''', [missing_obj_subselection('pets', '[Pet]', 3, 17)]) | |
tests/core_validation/test_scalar_leafs.py:41: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_scalar_leafs.py:15: in missing_obj_subselection | |
'message': ScalarLeafs.required_message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field = 'pets', type = '[Pet]' | |
@staticmethod | |
def required_message(field, type): | |
> return 'Field "{}" of type "{}" must have a sub selection.'.format(field, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:131: ValueError | |
_________________ test_scalar_selection_not_allowed_on_boolean _________________ | |
def test_scalar_selection_not_allowed_on_boolean(): | |
expect_fails_rule(ScalarLeafs, ''' | |
fragment scalarSelectionsNotAllowedOnBoolean on Dog { | |
barks { sinceWhen } | |
} | |
> ''', [no_scalar_subselection('barks', 'Boolean', 3, 15)]) | |
tests/core_validation/test_scalar_leafs.py:57: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_scalar_leafs.py:8: in no_scalar_subselection | |
'message': ScalarLeafs.not_allowed_message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field = 'barks', type = 'Boolean' | |
@staticmethod | |
def not_allowed_message(field, type): | |
> return 'Field "{}" of type "{}" must not have a sub selection.'.format(field, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:127: ValueError | |
__________________ test_scalar_selection_not_allowed_on_enum ___________________ | |
def test_scalar_selection_not_allowed_on_enum(): | |
expect_fails_rule(ScalarLeafs, ''' | |
fragment scalarSelectionsNotAllowedOnEnum on Cat { | |
furColor { inHexdec } | |
} | |
> ''', [no_scalar_subselection('furColor', 'FurColor', 3, 18)]) | |
tests/core_validation/test_scalar_leafs.py:65: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_scalar_leafs.py:8: in no_scalar_subselection | |
'message': ScalarLeafs.not_allowed_message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field = 'furColor', type = 'FurColor' | |
@staticmethod | |
def not_allowed_message(field, type): | |
> return 'Field "{}" of type "{}" must not have a sub selection.'.format(field, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:127: ValueError | |
_________________ test_scalar_selection_not_allowed_with_args __________________ | |
def test_scalar_selection_not_allowed_with_args(): | |
expect_fails_rule(ScalarLeafs, ''' | |
fragment scalarSelectionsNotAllowedWithArgs on Dog { | |
doesKnowCommand(dogCommand: SIT) { sinceWhen } | |
} | |
> ''', [no_scalar_subselection('doesKnowCommand', 'Boolean', 3, 42)]) | |
tests/core_validation/test_scalar_leafs.py:73: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_scalar_leafs.py:8: in no_scalar_subselection | |
'message': ScalarLeafs.not_allowed_message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field = 'doesKnowCommand', type = 'Boolean' | |
@staticmethod | |
def not_allowed_message(field, type): | |
> return 'Field "{}" of type "{}" must not have a sub selection.'.format(field, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:127: ValueError | |
______________ test_scalar_selection_not_allowed_with_directives _______________ | |
def test_scalar_selection_not_allowed_with_directives(): | |
expect_fails_rule(ScalarLeafs, ''' | |
fragment scalarSelectionsNotAllowedWithDirectives on Dog { | |
name @include(if: true) { isAlsoHumanName } | |
} | |
> ''', [no_scalar_subselection('name', 'String', 3, 33)]) | |
tests/core_validation/test_scalar_leafs.py:81: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_scalar_leafs.py:8: in no_scalar_subselection | |
'message': ScalarLeafs.not_allowed_message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field = 'name', type = 'String' | |
@staticmethod | |
def not_allowed_message(field, type): | |
> return 'Field "{}" of type "{}" must not have a sub selection.'.format(field, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:127: ValueError | |
__________ test_scalar_selection_not_allowed_with_directives_and_args __________ | |
def test_scalar_selection_not_allowed_with_directives_and_args(): | |
expect_fails_rule(ScalarLeafs, ''' | |
fragment scalarSelectionsNotAllowedWithDirectivesAndArgs on Dog { | |
doesKnowCommand(dogCommand: SIT) @include(if: true) { sinceWhen } | |
} | |
> ''', [no_scalar_subselection('doesKnowCommand', 'Boolean', 3, 61)]) | |
tests/core_validation/test_scalar_leafs.py:89: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_scalar_leafs.py:8: in no_scalar_subselection | |
'message': ScalarLeafs.not_allowed_message(field, type), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
field = 'doesKnowCommand', type = 'Boolean' | |
@staticmethod | |
def not_allowed_message(field, type): | |
> return 'Field "{}" of type "{}" must not have a sub selection.'.format(field, type) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:127: ValueError | |
____________________ test_multiple_operations_of_same_name _____________________ | |
def test_multiple_operations_of_same_name(): | |
expect_fails_rule(UniqueOperationNames, ''' | |
query Foo { | |
fieldA | |
} | |
query Foo { | |
fieldB | |
} | |
''', [ | |
> duplicate_op('Foo', 2, 13, 5, 13), | |
]) | |
tests/core_validation/test_unique_operation_names.py:81: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_unique_operation_names.py:8: in duplicate_op | |
'message': UniqueOperationNames.message(op_name), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
operation_name = 'Foo' | |
@staticmethod | |
def message(operation_name): | |
> return 'There can only be one operation named "{}".'.format(operation_name) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:31: ValueError | |
___________ test_multiple_operations_of_same_name_of_different_types ___________ | |
def test_multiple_operations_of_same_name_of_different_types(): | |
expect_fails_rule(UniqueOperationNames, ''' | |
query Foo { | |
fieldA | |
} | |
mutation Foo { | |
fieldB | |
} | |
''', [ | |
> duplicate_op('Foo', 2, 13, 5, 16), | |
]) | |
tests/core_validation/test_unique_operation_names.py:94: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
tests/core_validation/test_unique_operation_names.py:8: in duplicate_op | |
'message': UniqueOperationNames.message(op_name), | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
operation_name = 'Foo' | |
@staticmethod | |
def message(operation_name): | |
> return 'There can only be one operation named "{}".'.format(operation_name) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:31: ValueError | |
________________________ test_output_types_are_invalid _________________________ | |
def test_output_types_are_invalid(): | |
expect_fails_rule(VariablesAreInputTypes, ''' | |
query Foo($a: Dog, $b: [[CatOrDog!]]!, $c: Pet) { | |
field(a: $a, b: $b, c: $c) | |
} | |
''', [ | |
{'locations': [SourceLocation(2, 21)], | |
> 'message': VariablesAreInputTypes.message('a', 'Dog')}, | |
{'locations': [SourceLocation(2, 30)], | |
'message': VariablesAreInputTypes.message('b', '[[CatOrDog!]]!')}, | |
{'locations': [SourceLocation(2, 50)], | |
'message': VariablesAreInputTypes.message('c', 'Pet')}, | |
]) | |
tests/core_validation/test_variables_are_input_types.py:21: | |
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ | |
variable_name = 'a', type_name = 'Dog' | |
@staticmethod | |
def message(variable_name, type_name): | |
> return 'Variable "${}" cannot be non-input type "{}".'.format(variable_name, type_name) | |
E ValueError: zero length field name in format | |
.tox/py26/lib/python2.6/site-packages/graphql/core/validation/rules.py:106: ValueError | |
==================== 58 failed, 145 passed in 1.96 seconds ===================== | |
ERROR: InvocationError: 'graphql-py/.tox/py26/bin/py.test' | |
___________________________________ summary ____________________________________ | |
ERROR: py26: commands failed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment