summaryrefslogtreecommitdiffstats
path: root/tests/test_smart_completion_multiple_schemata.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-09-06 04:17:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-09-06 04:17:09 +0000
commit76d27bc43d56d7ef3ca0090fb199777888adf7c3 (patch)
treeb6d3d562a0be03d404426bb43aff62174be3dc5e /tests/test_smart_completion_multiple_schemata.py
parentAdding upstream version 3.1.0. (diff)
downloadpgcli-upstream/3.2.0.tar.xz
pgcli-upstream/3.2.0.zip
Adding upstream version 3.2.0.upstream/3.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/test_smart_completion_multiple_schemata.py')
-rw-r--r--tests/test_smart_completion_multiple_schemata.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/tests/test_smart_completion_multiple_schemata.py b/tests/test_smart_completion_multiple_schemata.py
index 805b727..5c9c9af 100644
--- a/tests/test_smart_completion_multiple_schemata.py
+++ b/tests/test_smart_completion_multiple_schemata.py
@@ -193,7 +193,7 @@ def test_suggested_joins(completer, query, tbl):
result = get_result(completer, query.format(tbl))
assert completions_to_set(result) == completions_to_set(
testdata.schemas_and_from_clause_items()
- + [join("custom.shipments ON shipments.user_id = {0}.id".format(tbl))]
+ + [join(f"custom.shipments ON shipments.user_id = {tbl}.id")]
)
@@ -350,6 +350,36 @@ def test_schema_qualified_function_name(completer):
)
+@parametrize("completer", completers(filtr=True, casing=False, aliasing=False))
+def test_schema_qualified_function_name_after_from(completer):
+ text = "SELECT * FROM custom.set_r"
+ result = get_result(completer, text)
+ assert completions_to_set(result) == completions_to_set(
+ [
+ function("set_returning_func()", -len("func")),
+ ]
+ )
+
+
+@parametrize("completer", completers(filtr=True, casing=False, aliasing=False))
+def test_unqualified_function_name_not_returned(completer):
+ text = "SELECT * FROM set_r"
+ result = get_result(completer, text)
+ assert completions_to_set(result) == completions_to_set([])
+
+
+@parametrize("completer", completers(filtr=True, casing=False, aliasing=False))
+def test_unqualified_function_name_in_search_path(completer):
+ completer.search_path = ["public", "custom"]
+ text = "SELECT * FROM set_r"
+ result = get_result(completer, text)
+ assert completions_to_set(result) == completions_to_set(
+ [
+ function("set_returning_func()", -len("func")),
+ ]
+ )
+
+
@parametrize("completer", completers(filtr=True, casing=False))
@parametrize(
"text",