Skip to content

Commit

Permalink
update test with null values
Browse files Browse the repository at this point in the history
- addresses graphql-python#118
- initial implementation by @yen223 in PR graphql-python#119
  • Loading branch information
jaemk committed May 4, 2018
1 parent b099fab commit 5b4ee87
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion graphql/language/tests/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
}
{
unnamed(truthy: true, falsey: false),
unnamed(truthy: true, falsey: false, nullish: null),
query
}
"""
Expand Down
10 changes: 4 additions & 6 deletions graphql/language/tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,8 @@ def test_does_not_accept_fragments_spread_of_on():
assert 'Syntax Error GraphQL (1:9) Expected Name, found }' in excinfo.value.message


def test_does_not_allow_null_value():
with raises(GraphQLSyntaxError) as excinfo:
parse('{ fieldWithNullableStringInput(input: null) }')

assert 'Syntax Error GraphQL (1:39) Unexpected Name "null"' in excinfo.value.message
def test_allows_null_value():
parse('{ fieldWithNullableStringInput(input: null) }')


def test_parses_multi_byte_characters():
Expand Down Expand Up @@ -130,7 +127,8 @@ def tesst_allows_non_keywords_anywhere_a_name_is_allowed():
'mutation',
'subscription',
'true',
'false'
'false',
'null',
]

query_template = '''
Expand Down
2 changes: 1 addition & 1 deletion graphql/language/tests/test_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_prints_kitchen_sink():
}
{
unnamed(truthy: true, falsey: false)
unnamed(truthy: true, falsey: false, nullish: null)
query
}
'''
6 changes: 6 additions & 0 deletions graphql/language/tests/test_visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,12 @@ def leave(self, node, key, parent, *args):
['enter', 'BooleanValue', 'value', 'Argument'],
['leave', 'BooleanValue', 'value', 'Argument'],
['leave', 'Argument', 1, None],
['enter', 'Argument', 2, None],
['enter', 'Name', 'name', 'Argument'],
['leave', 'Name', 'name', 'Argument'],
['enter', 'NullValue', 'value', 'Argument'],
['leave', 'NullValue', 'value', 'Argument'],
['leave', 'Argument', 2, None],
['leave', 'Field', 0, None],
['enter', 'Field', 1, None],
['enter', 'Name', 'name', 'Field'],
Expand Down

0 comments on commit 5b4ee87

Please sign in to comment.