1
1
mirror of https://github.com/dbcli/pgcli.git synced 2024-10-06 10:17:15 +03:00
pgcli/tests/test_sqlcompletion.py
2014-12-18 13:57:40 -08:00

19 lines
784 B
Python

from pgcli.packages.sqlcompletion import suggest_type
class TestSqlCompletion:
def test_lparen_suggest_cols(self):
suggestion = suggest_type('SELECT MAX( FROM table_name', 'SELECT MAX(')
assert (suggestion and suggestion[0] == 'columns')
def test_select_suggest_cols_and_funcs(self):
suggestion = suggest_type('SELECT ', 'SELECT ')
assert (suggestion and suggestion[0] == 'columns-and-functions')
def test_from_suggest_tables(self):
suggestion = suggest_type('SELECT * FROM ', 'SELECT * FROM ')
assert (suggestion and suggestion[0] == 'tables')
def test_distinct_suggest_cols(self):
suggestion = suggest_type('SELECT DISTINCT ', 'SELECT DISTINCT ')
assert (suggestion and suggestion[0] == 'columns')