示例#1
0
def test_builtin_function_name_completion(completer):
    result = get_result(completer, "SELECT MA")
    assert completions_to_set(result) == completions_to_set([
        function("MAX", -2),
        keyword("MAXEXTENTS", -2),
        keyword("MATERIALIZED VIEW", -2),
    ])
示例#2
0
def test_builtin_function_name_completion(completer):
    result = result_set(completer, 'SELECT MA')
    assert result == set([
        function('MAX', -2),
        keyword('MAXEXTENTS', -2),
        keyword('MATERIALIZED VIEW', -2)
    ])
示例#3
0
def test_builtin_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 set(result) == set([
        function('MAX', -2),
        keyword('MAXEXTENTS', -2),
        keyword('MATERIALIZED VIEW', -2),
    ])
示例#4
0
def test_builtin_function_name_completion(completer):
    result = get_result(completer, "SELECT MA")
    assert completions_to_set(result) == completions_to_set([
        function("MAKE_DATE", -2),
        function("MAKE_INTERVAL", -2),
        function("MAKE_TIME", -2),
        function("MAKE_TIMESTAMP", -2),
        function("MAKE_TIMESTAMPTZ", -2),
        function("MASKLEN", -2),
        function("MAX", -2),
        keyword("MAXEXTENTS", -2),
        keyword("MATERIALIZED VIEW", -2),
    ])
def test_select_keyword_completion(completer, complete_event):
    text = 'SEL'
    position = len('SEL')
    result = completer.get_completions(
        Document(text=text, cursor_position=position),
        complete_event)
    assert set(result) == set([keyword('SELECT', -3)])
def test_select_keyword_completion(completer, complete_event):
    text = 'SEL'
    position = len('SEL')
    result = completer.get_completions(
        Document(text=text, cursor_position=position),
        complete_event)
    assert set(result) == set([keyword('SELECT', -3)])
def test_builtin_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 set(result) == set([function('MAX', -2),
                               keyword('MAXEXTENTS', -2),
                              ])
def test_columns_before_keywords(completer):
    text = 'SELECT * FROM orders WHERE s'
    completions = get_result(completer, text)

    col = column('status', -1)
    kw = keyword('SELECT', -1)

    assert completions.index(col) < completions.index(kw)
def test_user_function_name_completion(completer):
    result = result_set(completer, 'SELECT cu')
    assert result == set([
        function('custom_fun()', -2),
        function('_custom_fun()', -2),
        function('custom_func1()', -2),
        function('custom_func2()', -2),
        keyword('CURRENT', -2),
    ])
def test_user_function_name_completion(completer):
    result = result_set(completer, 'SELECT cu')
    assert result == set([
        function('custom_fun()', -2),
        function('_custom_fun()', -2),
        function('custom_func1()', -2),
        function('custom_func2()', -2),
        keyword('CURRENT', -2),
    ])
示例#11
0
def test_user_function_name_completion(completer):
    result = get_result(completer, "SELECT cu")
    assert completions_to_set(result) == completions_to_set([
        function("custom_fun()", -2),
        function("_custom_fun()", -2),
        function("custom_func1()", -2),
        function("custom_func2()", -2),
        keyword("CURRENT", -2),
    ])
def test_columns_before_keywords(completer, complete_event):
    sql = 'SELECT * FROM orders WHERE s'
    completions = completer.get_completions(
        Document(text=sql, cursor_position=len(sql)), complete_event)

    col = column('status', -1)
    kw = keyword('SELECT', -1)

    assert completions.index(col) < completions.index(kw)
def test_user_function_name_completion(completer):
    result = get_result(completer, 'SELECT cu')
    assert completions_to_set(result) == completions_to_set([
        function('custom_fun()', -2),
        function('_custom_fun()', -2),
        function('custom_func1()', -2),
        function('custom_func2()', -2),
        keyword('CURRENT', -2),
    ])
def test_columns_before_keywords(completer, complete_event):
    sql = 'SELECT * FROM orders WHERE s'
    completions = completer.get_completions(
        Document(text=sql, cursor_position=len(sql)), complete_event)

    col = column('status', -1)
    kw = keyword('SELECT', -1)

    assert completions.index(col) < completions.index(kw)
def test_user_function_name_completion(completer, complete_event):
    text = 'SELECT cu'
    position = len('SELECT cu')
    result = completer.get_completions(
        Document(text=text, cursor_position=position), complete_event)
    assert set(result) == set([
        function('custom_func1', -2),
        function('custom_func2', -2),
        keyword('CURRENT', -2),
        ])
def test_user_function_name_completion(completer, complete_event):
    text = 'SELECT cu'
    position = len('SELECT cu')
    result = completer.get_completions(
        Document(text=text, cursor_position=position), complete_event)
    assert set(result) == set([
        function('custom_fun()', -2),
        function('_custom_fun()', -2),
        function('custom_func1()', -2),
        function('custom_func2()', -2),
        keyword('CURRENT', -2),
    ])
def test_select_keyword_completion(completer):
    result = result_set(completer, 'SEL')
    assert result == set([keyword('SELECT', -3)])
def test_builtin_function_name_completion(completer):
    result = get_result(completer, 'SELECT MA')
    assert completions_to_set(result) == completions_to_set([
        function('MAX', -2),
        keyword('MAXEXTENTS', -2), keyword('MATERIALIZED VIEW', -2)
    ])
def test_select_keyword_completion(completer):
    result = get_result(completer, 'SEL')
    assert completions_to_set(result) == completions_to_set(
        [keyword('SELECT', -3)])
def test_select_keyword_completion(completer):
    result = result_set(completer, 'SEL')
    assert result == set([keyword('SELECT', -3)])
def test_builtin_function_name_completion(completer):
    result = result_set(completer, 'SELECT MA')
    assert result == set([
        function('MAX', -2),
        keyword('MAXEXTENTS', -2), keyword('MATERIALIZED VIEW', -2)
    ])