@@ -14,6 +14,15 @@ def test_repr_loc():
1414 assert repr (loc ) == '<Loc start=10 end=25 source=foo>'
1515
1616
17+ def test_empty_parse ():
18+ with raises (GraphQLSyntaxError ) as excinfo :
19+ parse ("" )
20+ assert (
21+ u'Syntax Error GraphQL (1:1) Unexpected EOF\n '
22+ u'\n '
23+ ) == excinfo .value .message
24+
25+
1726def test_parse_provides_useful_errors ():
1827 with raises (GraphQLSyntaxError ) as excinfo :
1928 parse ("""{""" )
@@ -32,15 +41,18 @@ def test_parse_provides_useful_errors():
3241 parse ("""{ ...MissingOn }
3342fragment MissingOn Type
3443""" )
35- assert 'Syntax Error GraphQL (2:20) Expected "on", found Name "Type"' in str (excinfo .value )
44+ assert 'Syntax Error GraphQL (2:20) Expected "on", found Name "Type"' in str (
45+ excinfo .value )
3646
3747 with raises (GraphQLSyntaxError ) as excinfo :
3848 parse ('{ field: {} }' )
39- assert 'Syntax Error GraphQL (1:10) Expected Name, found {' in str (excinfo .value )
49+ assert 'Syntax Error GraphQL (1:10) Expected Name, found {' in str (
50+ excinfo .value )
4051
4152 with raises (GraphQLSyntaxError ) as excinfo :
4253 parse ('notanoperation Foo { field }' )
43- assert 'Syntax Error GraphQL (1:1) Unexpected Name "notanoperation"' in str (excinfo .value )
54+ assert 'Syntax Error GraphQL (1:1) Unexpected Name "notanoperation"' in str (
55+ excinfo .value )
4456
4557 with raises (GraphQLSyntaxError ) as excinfo :
4658 parse ('...' )
@@ -50,7 +62,8 @@ def test_parse_provides_useful_errors():
5062def test_parse_provides_useful_error_when_using_source ():
5163 with raises (GraphQLSyntaxError ) as excinfo :
5264 parse (Source ('query' , 'MyQuery.graphql' ))
53- assert 'Syntax Error MyQuery.graphql (1:6) Expected {, found EOF' in str (excinfo .value )
65+ assert 'Syntax Error MyQuery.graphql (1:6) Expected {, found EOF' in str (
66+ excinfo .value )
5467
5568
5669def test_parses_variable_inline_values ():
0 commit comments