summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmjith Ramanujam <amjith.r@gmail.com>2015-08-01 08:29:33 -0700
committerAmjith Ramanujam <amjith.r@gmail.com>2015-08-01 08:29:33 -0700
commit09ccb535ec60420a2239f6a4146ba26cf0e3f957 (patch)
treeaa63fab83938970990d23c0d6a52430e665ba961
parent5de07bdbde604795aec3dac9b4a0120fddfb1795 (diff)
Add a test for the crashing bug fix.
-rw-r--r--tests/test_sqlcompletion.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/test_sqlcompletion.py b/tests/test_sqlcompletion.py
index 277936e9..2fe4cbea 100644
--- a/tests/test_sqlcompletion.py
+++ b/tests/test_sqlcompletion.py
@@ -248,6 +248,14 @@ def test_join_suggests_tables_and_schemas(tbl_alias, join_type):
{'type': 'view', 'schema': []},
{'type': 'schema'}])
+def test_left_join_with_comma():
+ text = 'select * from foo f left join bar b,'
+ suggestions = suggest_type(text, text)
+ assert sorted_dicts(suggestions) == sorted_dicts([
+ {'type': 'table', 'schema': []},
+ {'type': 'view', 'schema': []},
+ {'type': 'schema'}])
+
def test_join_alias_dot_suggests_cols1():
suggestions = suggest_type('SELECT * FROM abc a JOIN def d ON a.',
'SELECT * FROM abc a JOIN def d ON a.')
@@ -290,7 +298,6 @@ def test_on_suggests_tables_right_side():
'select abc.x, bcd.y from abc join bcd on ')
assert suggestions == [{'type': 'alias', 'aliases': ['abc', 'bcd']}]
-
@pytest.mark.parametrize('col_list', ['', 'col1, '])
def test_join_using_suggests_common_columns(col_list):
text = 'select * from abc inner join def using (' + col_list
@@ -382,7 +389,7 @@ def test_handle_pre_completion_comma_gracefully(text):
def test_drop_schema_suggests_schemas():
sql = 'DROP SCHEMA '
assert suggest_type(sql, sql) == [{'type': 'schema'}]
-
+
@pytest.mark.parametrize('text', [
'SELECT x::',