diff options
author | Darik Gamble <darik.gamble.spam@gmail.com> | 2015-10-03 14:10:51 -0400 |
---|---|---|
committer | Darik Gamble <darik.gamble.spam@gmail.com> | 2015-10-03 14:10:51 -0400 |
commit | 9a7cae6cf57a2c9392dd38321b46f2669d6d88db (patch) | |
tree | 8f49dfd466c0bbba72138dc22cef2f561e546a0e /tests/test_sqlcompletion.py | |
parent | ee0995ceedb44a2b20df10433ae1cd1c204d0b5c (diff) |
Expand more join tests to check compound statements
Diffstat (limited to 'tests/test_sqlcompletion.py')
-rw-r--r-- | tests/test_sqlcompletion.py | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/tests/test_sqlcompletion.py b/tests/test_sqlcompletion.py index fa0e0f35..dfa59adb 100644 --- a/tests/test_sqlcompletion.py +++ b/tests/test_sqlcompletion.py @@ -381,31 +381,39 @@ def test_join_alias_dot_suggests_cols2(sql): {'type': 'function', 'schema': 'd'}]) -def test_on_suggests_aliases(): - suggestions = suggest_type( - 'select a.x, b.y from abc a join bcd b on ', - 'select a.x, b.y from abc a join bcd b on ') +@pytest.mark.parametrize('sql', [ + 'select a.x, b.y from abc a join bcd b on ', + 'select a.x, b.y from abc a join bcd b on a.id = b.id OR ', +]) +def test_on_suggests_aliases(sql): + suggestions = suggest_type(sql, sql) assert suggestions == [{'type': 'alias', 'aliases': ['a', 'b']}] -def test_on_suggests_tables(): - suggestions = suggest_type( - 'select abc.x, bcd.y from abc join bcd on ', - 'select abc.x, bcd.y from abc join bcd on ') +@pytest.mark.parametrize('sql', [ + 'select abc.x, bcd.y from abc join bcd on ', + 'select abc.x, bcd.y from abc join bcd on abc.id = bcd.id AND ', +]) +def test_on_suggests_tables(sql): + suggestions = suggest_type(sql, sql) assert suggestions == [{'type': 'alias', 'aliases': ['abc', 'bcd']}] -def test_on_suggests_aliases_right_side(): - suggestions = suggest_type( - 'select a.x, b.y from abc a join bcd b on a.id = ', - 'select a.x, b.y from abc a join bcd b on a.id = ') +@pytest.mark.parametrize('sql', [ + 'select a.x, b.y from abc a join bcd b on a.id = ', + 'select a.x, b.y from abc a join bcd b on a.id = b.id AND a.id2 = ', +]) +def test_on_suggests_aliases_right_side(sql): + suggestions = suggest_type(sql, sql) assert suggestions == [{'type': 'alias', 'aliases': ['a', 'b']}] -def test_on_suggests_tables_right_side(): - suggestions = suggest_type( - 'select abc.x, bcd.y from abc join bcd on ', - 'select abc.x, bcd.y from abc join bcd on ') +@pytest.mark.parametrize('sql', [ + 'select abc.x, bcd.y from abc join bcd on ', + 'select abc.x, bcd.y from abc join bcd on abc.id = bcd.id and ', +]) +def test_on_suggests_tables_right_side(sql): + suggestions = suggest_type(sql, sql) assert suggestions == [{'type': 'alias', 'aliases': ['abc', 'bcd']}] |