Beispiel #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
Beispiel #2
0
def test_parse_exceptions(tokens, exception):
    with pytest.raises(exception):
        list(parse(tokens))
Beispiel #3
0
def assert_statements(tokens1, statements2):
    parsed_statements = list(parse(tokens1))
    assert parsed_statements == statements2
Beispiel #4
0
def test_parse_exceptions(tokens, exception):
    with pytest.raises(exception):
        list(parse(tokens))
Beispiel #5
0
def assert_statements(tokens1, statements2):
    parsed_statements = list(parse(tokens1))
    assert parsed_statements == statements2