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