summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDarik Gamble <darik.gamble@gmail.com>2015-04-06 18:28:11 -0400
committerDarik Gamble <darik.gamble@gmail.com>2015-04-06 18:30:05 -0400
commitc7307e5a7d03c763a0aca0533a3258b0e78e21cc (patch)
treebff9972bd1039c8961a444ec018e5358799c3a29 /tests
parent1fad19a5845f66e5f8ce3108f6b3846804d3647a (diff)
find_prev_keyword strips everything after the last keyword
Diffstat (limited to 'tests')
-rw-r--r--tests/test_parseutils.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/test_parseutils.py b/tests/test_parseutils.py
index 46d5d3b2..a93e1190 100644
--- a/tests/test_parseutils.py
+++ b/tests/test_parseutils.py
@@ -1,6 +1,6 @@
import pytest
from pgcli.packages.parseutils import extract_tables
-
+from pgcli.packages.parseutils import find_prev_keyword
def test_empty_string():
tables = extract_tables('')
@@ -84,3 +84,7 @@ def test_join_as_table():
tables = extract_tables('SELECT * FROM my_table AS m WHERE m.a > 5')
assert tables == [(None, 'my_table', 'm')]
+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 ('