def test_find_prev_keyword_using(): q = 'select * from tbl1 inner join tbl2 using (col1, ' kw, q2 = find_prev_keyword(q) assert kw == '(' and q2 == 'select * from tbl1 inner join tbl2 using ('
def test_find_prev_keyword_open_parens(sql): kw, _ = find_prev_keyword(sql) assert kw == '('
def test_find_prev_keyword_where(sql): kw, stripped = find_prev_keyword(sql) assert kw == 'where' and stripped == 'select * from foo where'
def test_find_prev_keyword_open_parens(sql): kw, _ = find_prev_keyword(sql) assert kw.value == '('
def test_find_prev_keyword_where(sql): kw, stripped = find_prev_keyword(sql) assert kw.value == 'where' and stripped == 'select * from foo where'