summaryrefslogtreecommitdiffstats
path: root/tests/test_smart_completion_public_schema_only.py
diff options
context:
space:
mode:
authorkoljonen <koljonen@outlook.com>2016-06-18 16:34:11 +0200
committerkoljonen <koljonen@outlook.com>2016-06-18 21:24:02 +0200
commit932603130d4a4ee01f446aaf8c033c0809868c2f (patch)
tree029ff54ecc49144203d707dfa185cf10bd60b569 /tests/test_smart_completion_public_schema_only.py
parenta79e1240255e116071df5d0aaf1017604577a8ee (diff)
In completion tests, get functions from metadata instead of manually listing them
Diffstat (limited to 'tests/test_smart_completion_public_schema_only.py')
-rw-r--r--tests/test_smart_completion_public_schema_only.py35
1 files changed, 8 insertions, 27 deletions
diff --git a/tests/test_smart_completion_public_schema_only.py b/tests/test_smart_completion_public_schema_only.py
index 580f567b..9794c2e7 100644
--- a/tests/test_smart_completion_public_schema_only.py
+++ b/tests/test_smart_completion_public_schema_only.py
@@ -67,10 +67,7 @@ def test_schema_or_visible_table_completion(completer, complete_event):
result = completer.get_completions(
Document(text=text, cursor_position=position), complete_event)
assert set(result) == set(testdata.schemas()
- + testdata.views() + testdata.tables() + [
- function('custom_func1'),
- function('custom_func2'),
- function('set_returning_func')])
+ + testdata.views() + testdata.tables() + testdata.functions())
def test_builtin_function_name_completion(completer, complete_event):
@@ -135,9 +132,7 @@ def test_suggested_column_names_from_visible_table(completer, complete_event):
column('email'),
column('first_name'),
column('last_name'),
- function('custom_func1'),
- function('custom_func2'),
- function('set_returning_func')] +
+ ] + testdata.functions() +
list(testdata.builtin_functions() +
testdata.keywords())
)
@@ -220,9 +215,7 @@ def test_suggested_multiple_column_names(completer, complete_event):
column('email'),
column('first_name'),
column('last_name'),
- function('custom_func1'),
- function('custom_func2'),
- function('set_returning_func')] +
+ ] + testdata.functions() +
list(testdata.builtin_functions() +
testdata.keywords())
)
@@ -377,9 +370,7 @@ def test_suggested_joins(completer, complete_event, text):
join('"Users" ON "Users".userid = users.id'),
join('users users2 ON users2.id = users.parentid'),
join('users users2 ON users2.parentid = users.id'),
- function('custom_func2'),
- function('set_returning_func'),
- function('custom_func1')])
+ ] + testdata.functions())
@pytest.mark.parametrize('text', [
'SELECT * FROM public."Users" JOIN ',
@@ -396,9 +387,7 @@ def test_suggested_joins_quoted_schema_qualified_table(completer, complete_event
assert set(result) == set(testdata.schemas() + testdata.tables()
+ testdata.views() + [
join('public.users ON users.id = "Users".userid'),
- function('custom_func2'),
- function('set_returning_func'),
- function('custom_func1')])
+ ] + testdata.functions())
@pytest.mark.parametrize('text', [
'SELECT u.name, o.id FROM users u JOIN orders o ON ',
@@ -508,11 +497,7 @@ def test_table_names_after_from(completer, complete_event, text):
Document(text=text, cursor_position=position),
complete_event)
assert set(result) == set(testdata.schemas() + testdata.tables()
- + testdata.views() + [
- function('custom_func1'),
- function('custom_func2'),
- function('set_returning_func')
- ])
+ + testdata.views() + testdata.functions())
assert [c.text for c in result] == [
'"Users"',
'custom_func1',
@@ -535,9 +520,7 @@ def test_auto_escaped_col_names(completer, complete_event):
column('id'),
column('"insert"'),
column('"ABC"'),
- function('custom_func1'),
- function('custom_func2'),
- function('set_returning_func')] +
+ ] + testdata.functions() +
list(testdata.builtin_functions() +
testdata.keywords())
)
@@ -588,9 +571,7 @@ def test_suggest_columns_from_set_returning_function(completer, complete_event):
assert set(result) == set([
column('x'),
column('y'),
- function('custom_func1'),
- function('custom_func2'),
- function('set_returning_func')]
+ ] + testdata.functions()
+ list(testdata.builtin_functions()
+ testdata.keywords()))