Exemplo n.º 1
0
def test_parse_bad():
    from graphql_parser import GraphQLParser
    with pytest.raises(GraphQLParser.GraphQLParseError):
        assert GraphQLParser.graphql_parse_string('{query {id')
Exemplo n.º 2
0
    def visit_inline_fragment(self, node):
        print(node.__class__, node.get_name().get_value())
        return 1

    def visit_fragment_definition(self, node):
        print(node.__class__, node.get_name().get_value())
        return 1

    def visit_variable(self, node):
        print(node.__class__, node.get_name().get_value())
        return 1

    def visit_object_field(self, node):
        print(node.__class__, node.get_name().get_value())
        return 1

    def visit_directive(self, node):
        print(node.__class__, node.get_name().get_value())
        return 1

    def visit_int_value(self, node):
        print(node.__class__, node.get_value())
        return 1


if __name__ == '__main__':
    query = sys.argv[1]
    node = GraphQLParser.graphql_parse_string(query)
    Visitor().visit_node(node)
Exemplo n.º 3
0
def test_parse_ok():
    from graphql_parser import GraphQLParser
    assert GraphQLParser.graphql_parse_string('{query {id}}')