summaryrefslogtreecommitdiffstats
path: root/tests/test_sqlcompletion.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_sqlcompletion.py')
-rw-r--r--tests/test_sqlcompletion.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/tests/test_sqlcompletion.py b/tests/test_sqlcompletion.py
index ed647fc6..c5ef7b7d 100644
--- a/tests/test_sqlcompletion.py
+++ b/tests/test_sqlcompletion.py
@@ -101,10 +101,14 @@ def test_where_equals_any_suggests_columns_or_keywords():
assert set(suggestions) == cols_etc("tabl", last_keyword="WHERE")
-def test_lparen_suggests_cols():
+def test_lparen_suggests_cols_and_funcs():
suggestion = suggest_type("SELECT MAX( FROM tbl", "SELECT MAX(")
assert set(suggestion) == set(
- [Column(table_refs=((None, "tbl", None, False),), qualifiable=True)]
+ [
+ Column(table_refs=((None, "tbl", None, False),), qualifiable=True),
+ Function(schema=None),
+ Keyword("("),
+ ]
)
@@ -282,6 +286,23 @@ def test_distinct_and_order_by_suggestions_with_alias_given(text, text_before):
)
+def test_function_arguments_with_alias_given():
+ suggestions = suggest_type("SELECT avg(x. FROM tbl x, tbl2 y", "SELECT avg(x.")
+
+ assert set(suggestions) == set(
+ [
+ Column(
+ table_refs=(TableReference(None, "tbl", "x", False),),
+ local_tables=(),
+ qualifiable=False,
+ ),
+ Table(schema="x"),
+ View(schema="x"),
+ Function(schema="x"),
+ ]
+ )
+
+
def test_col_comma_suggests_cols():
suggestions = suggest_type("SELECT a, b, FROM tbl", "SELECT a, b,")
assert set(suggestions) == set(