summaryrefslogtreecommitdiffstats
path: root/tests/test_smart_completion_multiple_schemata.py
diff options
context:
space:
mode:
authorkoljonen <koljonen@outlook.com>2016-06-09 23:38:33 +0200
committerkoljonen <koljonen@outlook.com>2016-06-16 19:27:57 +0200
commit5b20e107b8611fc8bddbebf8459af50ada759806 (patch)
tree0a5e1c698041cb1890c0d2639564975a9a717d60 /tests/test_smart_completion_multiple_schemata.py
parent9e98896bb3557b9a3cd21b4d8369d5427b66b770 (diff)
Fix some join-condition issues
When self-joining a table with an FK to or from some other table, we got a false FK-join suggestion for that column. There was also a problem with quoted tables not being quoted in the join condition. And there were a couple of problems when trying to join a non-existent table or using a non-existent qualifier (`SELECT * FROM Foo JOIN Bar ON Meow.`). I also rewrote get_join_condition_matches a bit in the process, hopefully making it a bit simpler.
Diffstat (limited to 'tests/test_smart_completion_multiple_schemata.py')
-rw-r--r--tests/test_smart_completion_multiple_schemata.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/tests/test_smart_completion_multiple_schemata.py b/tests/test_smart_completion_multiple_schemata.py
index 9f74a7d4..b5ac0d3a 100644
--- a/tests/test_smart_completion_multiple_schemata.py
+++ b/tests/test_smart_completion_multiple_schemata.py
@@ -100,17 +100,18 @@ def test_schema_or_visible_table_completion(completer, complete_event):
Completion(text='orders', start_position=0, display_meta='table')])
-@pytest.mark.parametrize('text', [
- 'SELECT FROM users',
- 'SELECT FROM "users"',
+@pytest.mark.parametrize('table', [
+ 'users',
+ '"users"',
])
-def test_suggested_column_names_from_shadowed_visible_table(completer, complete_event, text):
+def test_suggested_column_names_from_shadowed_visible_table(completer, complete_event, table):
"""
Suggest column and function names when selecting from table
:param completer:
:param complete_event:
:return:
"""
+ text = 'SELECT FROM ' + table
position = len('SELECT ')
result = set(completer.get_completions(
Document(text=text, cursor_position=position),