@@ -14,6 +14,15 @@ def test_repr_loc():
14
14
assert repr (loc ) == '<Loc start=10 end=25 source=foo>'
15
15
16
16
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
+
17
26
def test_parse_provides_useful_errors ():
18
27
with raises (GraphQLSyntaxError ) as excinfo :
19
28
parse ("""{""" )
@@ -32,15 +41,18 @@ def test_parse_provides_useful_errors():
32
41
parse ("""{ ...MissingOn }
33
42
fragment MissingOn Type
34
43
""" )
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 )
36
46
37
47
with raises (GraphQLSyntaxError ) as excinfo :
38
48
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 )
40
51
41
52
with raises (GraphQLSyntaxError ) as excinfo :
42
53
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 )
44
56
45
57
with raises (GraphQLSyntaxError ) as excinfo :
46
58
parse ('...' )
@@ -50,7 +62,8 @@ def test_parse_provides_useful_errors():
50
62
def test_parse_provides_useful_error_when_using_source ():
51
63
with raises (GraphQLSyntaxError ) as excinfo :
52
64
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 )
54
67
55
68
56
69
def test_parses_variable_inline_values ():
0 commit comments