Adding upstream version 1.31.1.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
f38abee4bc
commit
9aaa9c7fe0
27 changed files with 387 additions and 394 deletions
|
@ -72,33 +72,29 @@ def test_table_completion(completer, complete_event):
|
|||
text = "SELECT * FROM "
|
||||
position = len(text)
|
||||
result = completer.get_completions(Document(text=text, cursor_position=position), complete_event)
|
||||
assert list(result) == list(
|
||||
[
|
||||
Completion(text="users", start_position=0),
|
||||
Completion(text="orders", start_position=0),
|
||||
Completion(text="`select`", start_position=0),
|
||||
Completion(text="`réveillé`", start_position=0),
|
||||
]
|
||||
)
|
||||
assert list(result) == list([
|
||||
Completion(text="users", start_position=0),
|
||||
Completion(text="orders", start_position=0),
|
||||
Completion(text="`select`", start_position=0),
|
||||
Completion(text="`réveillé`", start_position=0),
|
||||
])
|
||||
|
||||
|
||||
def test_function_name_completion(completer, complete_event):
|
||||
text = "SELECT MA"
|
||||
position = len("SELECT MA")
|
||||
result = completer.get_completions(Document(text=text, cursor_position=position), complete_event)
|
||||
assert list(result) == list(
|
||||
[
|
||||
Completion(text="MAX", start_position=-2),
|
||||
Completion(text="CHANGE MASTER TO", start_position=-2),
|
||||
Completion(text="CURRENT_TIMESTAMP", start_position=-2),
|
||||
Completion(text="DECIMAL", start_position=-2),
|
||||
Completion(text="FORMAT", start_position=-2),
|
||||
Completion(text="MASTER", start_position=-2),
|
||||
Completion(text="PRIMARY", start_position=-2),
|
||||
Completion(text="ROW_FORMAT", start_position=-2),
|
||||
Completion(text="SMALLINT", start_position=-2),
|
||||
]
|
||||
)
|
||||
assert list(result) == list([
|
||||
Completion(text="MAX", start_position=-2),
|
||||
Completion(text="CHANGE MASTER TO", start_position=-2),
|
||||
Completion(text="CURRENT_TIMESTAMP", start_position=-2),
|
||||
Completion(text="DECIMAL", start_position=-2),
|
||||
Completion(text="FORMAT", start_position=-2),
|
||||
Completion(text="MASTER", start_position=-2),
|
||||
Completion(text="PRIMARY", start_position=-2),
|
||||
Completion(text="ROW_FORMAT", start_position=-2),
|
||||
Completion(text="SMALLINT", start_position=-2),
|
||||
])
|
||||
|
||||
|
||||
def test_suggested_column_names(completer, complete_event):
|
||||
|
@ -138,15 +134,13 @@ def test_suggested_column_names_in_function(completer, complete_event):
|
|||
text = "SELECT MAX( from users"
|
||||
position = len("SELECT MAX(")
|
||||
result = completer.get_completions(Document(text=text, cursor_position=position), complete_event)
|
||||
assert list(result) == list(
|
||||
[
|
||||
Completion(text="*", start_position=0),
|
||||
Completion(text="id", start_position=0),
|
||||
Completion(text="email", start_position=0),
|
||||
Completion(text="first_name", start_position=0),
|
||||
Completion(text="last_name", start_position=0),
|
||||
]
|
||||
)
|
||||
assert list(result) == list([
|
||||
Completion(text="*", start_position=0),
|
||||
Completion(text="id", start_position=0),
|
||||
Completion(text="email", start_position=0),
|
||||
Completion(text="first_name", start_position=0),
|
||||
Completion(text="last_name", start_position=0),
|
||||
])
|
||||
|
||||
|
||||
def test_suggested_column_names_with_table_dot(completer, complete_event):
|
||||
|
@ -160,15 +154,13 @@ def test_suggested_column_names_with_table_dot(completer, complete_event):
|
|||
text = "SELECT users. from users"
|
||||
position = len("SELECT users.")
|
||||
result = list(completer.get_completions(Document(text=text, cursor_position=position), complete_event))
|
||||
assert result == list(
|
||||
[
|
||||
Completion(text="*", start_position=0),
|
||||
Completion(text="id", start_position=0),
|
||||
Completion(text="email", start_position=0),
|
||||
Completion(text="first_name", start_position=0),
|
||||
Completion(text="last_name", start_position=0),
|
||||
]
|
||||
)
|
||||
assert result == list([
|
||||
Completion(text="*", start_position=0),
|
||||
Completion(text="id", start_position=0),
|
||||
Completion(text="email", start_position=0),
|
||||
Completion(text="first_name", start_position=0),
|
||||
Completion(text="last_name", start_position=0),
|
||||
])
|
||||
|
||||
|
||||
def test_suggested_column_names_with_alias(completer, complete_event):
|
||||
|
@ -182,15 +174,13 @@ def test_suggested_column_names_with_alias(completer, complete_event):
|
|||
text = "SELECT u. from users u"
|
||||
position = len("SELECT u.")
|
||||
result = list(completer.get_completions(Document(text=text, cursor_position=position), complete_event))
|
||||
assert result == list(
|
||||
[
|
||||
Completion(text="*", start_position=0),
|
||||
Completion(text="id", start_position=0),
|
||||
Completion(text="email", start_position=0),
|
||||
Completion(text="first_name", start_position=0),
|
||||
Completion(text="last_name", start_position=0),
|
||||
]
|
||||
)
|
||||
assert result == list([
|
||||
Completion(text="*", start_position=0),
|
||||
Completion(text="id", start_position=0),
|
||||
Completion(text="email", start_position=0),
|
||||
Completion(text="first_name", start_position=0),
|
||||
Completion(text="last_name", start_position=0),
|
||||
])
|
||||
|
||||
|
||||
def test_suggested_multiple_column_names(completer, complete_event):
|
||||
|
@ -231,15 +221,13 @@ def test_suggested_multiple_column_names_with_alias(completer, complete_event):
|
|||
text = "SELECT u.id, u. from users u"
|
||||
position = len("SELECT u.id, u.")
|
||||
result = list(completer.get_completions(Document(text=text, cursor_position=position), complete_event))
|
||||
assert result == list(
|
||||
[
|
||||
Completion(text="*", start_position=0),
|
||||
Completion(text="id", start_position=0),
|
||||
Completion(text="email", start_position=0),
|
||||
Completion(text="first_name", start_position=0),
|
||||
Completion(text="last_name", start_position=0),
|
||||
]
|
||||
)
|
||||
assert result == list([
|
||||
Completion(text="*", start_position=0),
|
||||
Completion(text="id", start_position=0),
|
||||
Completion(text="email", start_position=0),
|
||||
Completion(text="first_name", start_position=0),
|
||||
Completion(text="last_name", start_position=0),
|
||||
])
|
||||
|
||||
|
||||
def test_suggested_multiple_column_names_with_dot(completer, complete_event):
|
||||
|
@ -254,77 +242,65 @@ def test_suggested_multiple_column_names_with_dot(completer, complete_event):
|
|||
text = "SELECT users.id, users. from users u"
|
||||
position = len("SELECT users.id, users.")
|
||||
result = list(completer.get_completions(Document(text=text, cursor_position=position), complete_event))
|
||||
assert result == list(
|
||||
[
|
||||
Completion(text="*", start_position=0),
|
||||
Completion(text="id", start_position=0),
|
||||
Completion(text="email", start_position=0),
|
||||
Completion(text="first_name", start_position=0),
|
||||
Completion(text="last_name", start_position=0),
|
||||
]
|
||||
)
|
||||
assert result == list([
|
||||
Completion(text="*", start_position=0),
|
||||
Completion(text="id", start_position=0),
|
||||
Completion(text="email", start_position=0),
|
||||
Completion(text="first_name", start_position=0),
|
||||
Completion(text="last_name", start_position=0),
|
||||
])
|
||||
|
||||
|
||||
def test_suggested_aliases_after_on(completer, complete_event):
|
||||
text = "SELECT u.name, o.id FROM users u JOIN orders o ON "
|
||||
position = len("SELECT u.name, o.id FROM users u JOIN orders o ON ")
|
||||
result = list(completer.get_completions(Document(text=text, cursor_position=position), complete_event))
|
||||
assert result == list(
|
||||
[
|
||||
Completion(text="u", start_position=0),
|
||||
Completion(text="o", start_position=0),
|
||||
]
|
||||
)
|
||||
assert result == list([
|
||||
Completion(text="u", start_position=0),
|
||||
Completion(text="o", start_position=0),
|
||||
])
|
||||
|
||||
|
||||
def test_suggested_aliases_after_on_right_side(completer, complete_event):
|
||||
text = "SELECT u.name, o.id FROM users u JOIN orders o ON o.user_id = "
|
||||
position = len("SELECT u.name, o.id FROM users u JOIN orders o ON o.user_id = ")
|
||||
result = list(completer.get_completions(Document(text=text, cursor_position=position), complete_event))
|
||||
assert result == list(
|
||||
[
|
||||
Completion(text="u", start_position=0),
|
||||
Completion(text="o", start_position=0),
|
||||
]
|
||||
)
|
||||
assert result == list([
|
||||
Completion(text="u", start_position=0),
|
||||
Completion(text="o", start_position=0),
|
||||
])
|
||||
|
||||
|
||||
def test_suggested_tables_after_on(completer, complete_event):
|
||||
text = "SELECT users.name, orders.id FROM users JOIN orders ON "
|
||||
position = len("SELECT users.name, orders.id FROM users JOIN orders ON ")
|
||||
result = list(completer.get_completions(Document(text=text, cursor_position=position), complete_event))
|
||||
assert result == list(
|
||||
[
|
||||
Completion(text="users", start_position=0),
|
||||
Completion(text="orders", start_position=0),
|
||||
]
|
||||
)
|
||||
assert result == list([
|
||||
Completion(text="users", start_position=0),
|
||||
Completion(text="orders", start_position=0),
|
||||
])
|
||||
|
||||
|
||||
def test_suggested_tables_after_on_right_side(completer, complete_event):
|
||||
text = "SELECT users.name, orders.id FROM users JOIN orders ON orders.user_id = "
|
||||
position = len("SELECT users.name, orders.id FROM users JOIN orders ON orders.user_id = ")
|
||||
result = list(completer.get_completions(Document(text=text, cursor_position=position), complete_event))
|
||||
assert result == list(
|
||||
[
|
||||
Completion(text="users", start_position=0),
|
||||
Completion(text="orders", start_position=0),
|
||||
]
|
||||
)
|
||||
assert result == list([
|
||||
Completion(text="users", start_position=0),
|
||||
Completion(text="orders", start_position=0),
|
||||
])
|
||||
|
||||
|
||||
def test_table_names_after_from(completer, complete_event):
|
||||
text = "SELECT * FROM "
|
||||
position = len("SELECT * FROM ")
|
||||
result = list(completer.get_completions(Document(text=text, cursor_position=position), complete_event))
|
||||
assert result == list(
|
||||
[
|
||||
Completion(text="users", start_position=0),
|
||||
Completion(text="orders", start_position=0),
|
||||
Completion(text="`select`", start_position=0),
|
||||
Completion(text="`réveillé`", start_position=0),
|
||||
]
|
||||
)
|
||||
assert result == list([
|
||||
Completion(text="users", start_position=0),
|
||||
Completion(text="orders", start_position=0),
|
||||
Completion(text="`select`", start_position=0),
|
||||
Completion(text="`réveillé`", start_position=0),
|
||||
])
|
||||
|
||||
|
||||
def test_auto_escaped_col_names(completer, complete_event):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue