Exemplo n.º 1
0
def format_sql(s, debug=False):
    tokens = list(tokenize(s))
    if debug:
        print_non_data('Tokens: %s' % tokens)
    parsed = list(parse(tokens))
    if debug:
        print_non_data('Statements: %s' % parsed)
    styled = style(parsed)
    if debug:
        print_non_data('Output: %s' % styled)
    return styled
Exemplo n.º 2
0
def test_parse_exceptions(tokens, exception):
    with pytest.raises(exception):
        list(parse(tokens))
Exemplo n.º 3
0
def assert_statements(tokens1, statements2):
    parsed_statements = list(parse(tokens1))
    assert parsed_statements == statements2
Exemplo n.º 4
0
def test_parse_exceptions(tokens, exception):
    with pytest.raises(exception):
        list(parse(tokens))
Exemplo n.º 5
0
def assert_statements(tokens1, statements2):
    parsed_statements = list(parse(tokens1))
    assert parsed_statements == statements2