def test_wildcard_column_expansion_with_insert(completer, complete_event, text):
    pos = text.index('*') + 1
    completions = completer.get_completions(
        Document(text=text, cursor_position=pos), complete_event)

    expected = [wildcard_expansion('id, ordered_date, status')]
    assert expected == completions
def test_wildcard_column_expansion_with_insert(completer, complete_event, text):
    pos = text.index('*') + 1
    completions = completer.get_completions(
        Document(text=text, cursor_position=pos), complete_event)

    expected = [wildcard_expansion('id, ordered_date, status')]
    assert expected == completions
def test_wildcard_column_expansion_with_table_qualifier(completer, text, expected):
    position = len("SELECT users.*")

    completions = get_result(completer, text, position)

    expected = [wildcard_expansion(expected)]

    assert expected == completions
def test_wildcard_column_expansion_with_function(completer, text):
    position = len('SELECT *')

    completions = get_result(completer, text, position)

    col_list = 'x'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
Example #5
0
def test_wildcard_column_expansion(completer, text):
    position = text.find("*") + 1

    completions = get_result(completer, text, position)

    col_list = "id, parentid, email, first_name, last_name"
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_table_qualifier(completer, complete_event, text, expected):
    pos = len('SELECT users.*')

    completions = completer.get_completions(
        Document(text=text, cursor_position=pos), complete_event)

    expected = [wildcard_expansion(expected)]

    assert expected == completions
def test_wildcard_column_expansion_with_table_qualifier(completer, complete_event, text, expected):
    pos = len('SELECT users.*')

    completions = completer.get_completions(
        Document(text=text, cursor_position=pos), complete_event)

    expected = [wildcard_expansion(expected)]

    assert expected == completions
def test_wildcard_column_expansion_with_function(completer, text):
    position = len('SELECT *')

    completions = get_result(completer, text, position)

    col_list = 'x'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_alias(completer, text):
    position = text.find('*') + 1

    completions = get_result(completer, text, position)

    col_list = 'id, u.parentid, u.email, u.first_name, u.last_name'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_alias(completer, complete_event, sql):
    pos = sql.find('*') + 1

    completions = completer.get_completions(
        Document(text=sql, cursor_position=pos), complete_event)

    col_list = 'id, u.parentid, u.email, u.first_name, u.last_name'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_two_tables(completer):
    text = 'SELECT * FROM public."select" JOIN custom.users ON true'
    position = len('SELECT *')

    completions = get_result(completer, text, position)

    cols = ('"select".id, "select"."localtime", "select"."ABC", '
        'users.id, users.phone_number')
    expected = [wildcard_expansion(cols)]
    assert completions == expected
def test_wildcard_column_expansion_with_table_qualifier(completer):
    text = 'SELECT "select".* FROM public."select"'
    position = len('SELECT "select".*')

    completions = get_result(completer, text, position)

    col_list = 'id, "select"."localtime", "select"."ABC"'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_alias_qualifier(completer):
    text = 'SELECT p.* FROM custom.products p'
    position = len('SELECT p.*')

    completions = get_result(completer, text, position)

    col_list = 'id, p.product_name, p.price'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_alias_qualifier(completer):
    text = 'SELECT p.* FROM custom.products p'
    position = len('SELECT p.*')

    completions = get_result(completer, text, position)

    col_list = 'id, p.product_name, p.price'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_two_tables(completer):
    text = 'SELECT * FROM public."select" JOIN custom.users ON true'
    position = len('SELECT *')

    completions = get_result(completer, text, position)

    cols = ('"select".id, "select"."localtime", "select"."ABC", '
            'users.id, users.phone_number')
    expected = [wildcard_expansion(cols)]
    assert completions == expected
def test_wildcard_column_expansion_with_function(completer, complete_event, text):
    pos = len('SELECT *')

    completions = completer.get_completions(
        Document(text=text, cursor_position=pos), complete_event)

    col_list = 'x'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_table_qualifier(
    completer, text, expected
):
    position = len('SELECT users.*')

    completions = get_result(completer, text, position)

    expected = [wildcard_expansion(expected)]

    assert expected == completions
def test_wildcard_column_expansion_with_two_tables(completer):
    text = 'SELECT * FROM "select" JOIN users u ON true'
    position = len('SELECT *')

    completions = get_result(completer, text, position)

    cols = ('"select".id, "select".insert, "select"."ABC", '
        'u.id, u.parentid, u.email, u.first_name, u.last_name')
    expected = [wildcard_expansion(cols)]
    assert completions == expected
def test_wildcard_column_expansion_with_function(completer, complete_event, text):
    pos = len('SELECT *')

    completions = completer.get_completions(
        Document(text=text, cursor_position=pos), complete_event)

    col_list = 'x'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_table_qualifier(completer):
    text = 'SELECT "select".* FROM public."select"'
    position = len('SELECT "select".*')

    completions = get_result(completer, text, position)

    col_list = 'id, "select"."localtime", "select"."ABC"'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_alias(completer, complete_event, sql):
    pos = sql.find('*') + 1

    completions = completer.get_completions(
        Document(text=sql, cursor_position=pos), complete_event)

    col_list = 'id, u.parentid, u.email, u.first_name, u.last_name'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_two_tables_and_parent(completer):
    text = 'SELECT "select".* FROM "select" JOIN users u ON true'
    position = len('SELECT "select".*')

    completions = get_result(completer, text, position)

    col_list = 'id, "select".insert, "select"."ABC"'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_two_tables_and_parent(completer, complete_event):
    sql = 'SELECT "select".* FROM "select" JOIN users u ON true'
    pos = len('SELECT "select".*')

    completions = completer.get_completions(
        Document(text=sql, cursor_position=pos), complete_event)

    col_list = 'id, "select"."insert", "select"."ABC"'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_two_tables(completer, complete_event):
    sql = 'SELECT * FROM "select" JOIN users u ON true'
    pos = len('SELECT *')

    completions = completer.get_completions(
        Document(text=sql, cursor_position=pos), complete_event)

    cols = ('"select".id, "select"."insert", "select"."ABC", '
        'u.id, u.parentid, u.email, u.first_name, u.last_name')
    expected = [wildcard_expansion(cols)]
    assert completions == expected
def test_wildcard_column_expansion_with_alias_qualifier(completer, complete_event):
    sql = 'SELECT u.* FROM users u'
    pos = len('SELECT u.*')

    completions = completer.get_completions(
        Document(text=sql, cursor_position=pos), complete_event)

    col_list = 'id, u.parentid, u.email, u.first_name, u.last_name'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion(completer, complete_event):
    sql = 'SELECT * FROM users'
    pos = len('SELECT *')

    completions = completer.get_completions(
        Document(text=sql, cursor_position=pos), complete_event)

    col_list = 'id, parentid, email, first_name, last_name'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_two_tables(completer, complete_event):
    sql = 'SELECT * FROM "select" JOIN users u ON true'
    pos = len('SELECT *')

    completions = completer.get_completions(
        Document(text=sql, cursor_position=pos), complete_event)

    cols = ('"select".id, "select"."insert", "select"."ABC", '
            'u.id, u.parentid, u.email, u.first_name, u.last_name')
    expected = [wildcard_expansion(cols)]
    assert completions == expected
def test_wildcard_column_expansion_with_alias_qualifier(completer, complete_event):
    sql = 'SELECT p.* FROM custom.products p'
    pos = len('SELECT p.*')

    completions = completer.get_completions(
        Document(text=sql, cursor_position=pos), complete_event)

    col_list = 'id, p.product_name, p.price'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_two_tables(completer, complete_event):
    sql = 'SELECT * FROM public."select" JOIN custom.users ON true'
    pos = len('SELECT *')

    completions = completer.get_completions(
        Document(text=sql, cursor_position=pos), complete_event)

    cols = ('"select".id, "select"."insert", "select"."ABC", '
        'users.id, users.phone_number')
    expected = [wildcard_expansion(cols)]
    assert completions == expected
def test_wildcard_column_expansion_with_two_tables_and_parent(completer, complete_event):
    sql = 'SELECT "select".* FROM public."select" JOIN custom.users u ON true'
    pos = len('SELECT "select".*')

    completions = completer.get_completions(
        Document(text=sql, cursor_position=pos), complete_event)

    col_list = 'id, "select"."insert", "select"."ABC"'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_two_tables(completer, complete_event):
    sql = 'SELECT * FROM public."select" JOIN custom.users ON true'
    pos = len('SELECT *')

    completions = completer.get_completions(
        Document(text=sql, cursor_position=pos), complete_event)

    cols = ('"select".id, "select"."insert", "select"."ABC", '
        'users.id, users.phone_number')
    expected = [wildcard_expansion(cols)]
    assert completions == expected
def test_wildcard_column_expansion_with_table_qualifier(completer, complete_event):
    sql = 'SELECT "select".* FROM public."select"'
    pos = len('SELECT "select".*')

    completions = completer.get_completions(
        Document(text=sql, cursor_position=pos), complete_event)

    col_list = 'id, "select"."insert", "select"."ABC"'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_table_qualifier(completer, complete_event):
    sql = 'SELECT "select".* FROM public."select"'
    pos = len('SELECT "select".*')

    completions = completer.get_completions(
        Document(text=sql, cursor_position=pos), complete_event)

    col_list = 'id, "select"."insert", "select"."ABC"'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_alias_qualifier(completer, complete_event):
    sql = 'SELECT p.* FROM custom.products p'
    pos = len('SELECT p.*')

    completions = completer.get_completions(
        Document(text=sql, cursor_position=pos), complete_event)

    col_list = 'id, p.product_name, p.price'
    expected = [wildcard_expansion(col_list)]

    assert expected == completions
def test_wildcard_column_expansion_with_insert(completer, text):
    position = text.index('*') + 1
    completions = get_result(completer, text, position)

    expected = [wildcard_expansion('ordered_date, status')]
    assert expected == completions
def test_wildcard_column_expansion_with_insert(completer, text):
    position = text.index('*') + 1
    completions = get_result(completer, text, position)

    expected = [wildcard_expansion('ordered_date, status')]
    assert expected == completions