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