当前位置: 首页>>代码示例>>Python>>正文


Python utils.completions_to_set函数代码示例

本文整理汇总了Python中utils.completions_to_set函数的典型用法代码示例。如果您正苦于以下问题:Python completions_to_set函数的具体用法?Python completions_to_set怎么用?Python completions_to_set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了completions_to_set函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_suggested_multiple_column_names

def test_suggested_multiple_column_names(completer):
    result = get_result(
        completer, 'SELECT id,  from custom.products', len('SELECT id, ')
    )
    assert completions_to_set(result) == completions_to_set(testdata.columns_functions_and_keywords(
        'products', 'custom'
    ))
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_multiple_schemata.py

示例2: test_cased_joins

def test_cased_joins(completer, text):
    result = get_result(completer, text)
    assert completions_to_set(result) == completions_to_set([schema('PUBLIC')] + cased_rels + [
        join('"Users" ON "Users".UserID = Users.ID'),
        join('Users Users2 ON Users2.ID = Users.PARENTID'),
        join('Users Users2 ON Users2.PARENTID = Users.ID'),
    ])
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_public_schema_only.py

示例3: test_suggested_join_conditions

def test_suggested_join_conditions(completer, text):
    result = get_result(completer, text)
    assert completions_to_set(result) == completions_to_set([
        alias('users'),
        alias('shipments'),
        name_join('shipments.id = users.id'),
        fk_join('shipments.user_id = users.id')])
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_multiple_schemata.py

示例4: test_aliased_joins

def test_aliased_joins(completer, text):
    result = get_result(completer, text)
    assert completions_to_set(result) == completions_to_set(testdata.schemas() + aliased_rels + [
        join('"Users" U ON U.userid = Users.id'),
        join('users u ON u.id = Users.parentid'),
        join('users u ON u.parentid = Users.id'),
    ])
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_public_schema_only.py

示例5: test_suggested_aliases_after_on_right_side

def test_suggested_aliases_after_on_right_side(completer, text):
    position = len(
        'SELECT u.name, o.id FROM users u JOIN orders o ON o.user_id = '
    )
    result = get_result(completer, text, position)
    assert completions_to_set(result) == completions_to_set(
        [alias('u'), alias('o')])
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_public_schema_only.py

示例6: test_suggest_columns_from_aliased_set_returning_function

def test_suggest_columns_from_aliased_set_returning_function(completer):
    result = get_result(
        completer, 'select f. from set_returning_func() f', len('select f.')
    )
    assert completions_to_set(result) == completions_to_set(
        testdata.columns('set_returning_func', typ='functions')
    )
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_public_schema_only.py

示例7: test_user_function_name_completion_matches_anywhere

def test_user_function_name_completion_matches_anywhere(completer):
    result = get_result(completer, 'SELECT om')
    assert completions_to_set(result) == completions_to_set([
        function('custom_fun()', -2),
        function('_custom_fun()', -2),
        function('custom_func1()', -2),
        function('custom_func2()', -2)])
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_public_schema_only.py

示例8: test_suggested_auto_qualified_column_names_two_tables

def test_suggested_auto_qualified_column_names_two_tables(text, completer):
    position = text.index('  ') + 1
    cols = [column('U.' + c.lower()) for c in cased_users_col_names]
    cols += [column('"Users".' + c.lower()) for c in cased_users2_col_names]
    result = get_result(completer, text, position)
    assert completions_to_set(result) == completions_to_set(
        cols + testdata.functions_and_keywords())
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_public_schema_only.py

示例9: test_join_functions_using_suggests_common_columns

def test_join_functions_using_suggests_common_columns(completer):
    text = '''SELECT * FROM set_returning_func() f1
              INNER JOIN set_returning_func() f2 USING ('''
    result = get_result(completer, text)
    assert completions_to_set(result) == completions_to_set(
        testdata.columns('set_returning_func', typ='functions')
    )
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_public_schema_only.py

示例10: test_suggested_column_names_from_schema_qualifed_table

def test_suggested_column_names_from_schema_qualifed_table(completer):
    result = get_result(
        completer, 'SELECT  from custom.products', len('SELECT ')
    )
    assert completions_to_set(result) == completions_to_set(testdata.columns_functions_and_keywords(
        'products', 'custom'
    ))
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_multiple_schemata.py

示例11: test_all_schema_objects_with_aliases

def test_all_schema_objects_with_aliases(completer):
    text = ('SELECT * FROM ')
    result = get_result(completer, text)
    assert completions_to_set(result) >= completions_to_set(
        [table(x) for x in ('orders o', '"select" s', 'custom.shipments s')]
        + [function(x) for x in ('func2() f',)]
    )
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_multiple_schemata.py

示例12: test_suggest_columns_from_set_returning_function

def test_suggest_columns_from_set_returning_function(completer):
    result = get_result(
        completer, 'select  from set_returning_func()', len('select ')
    )
    assert completions_to_set(result) == completions_to_set(testdata.columns_functions_and_keywords(
        'set_returning_func', typ='functions'
    ))
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_public_schema_only.py

示例13: test_all_schema_objects_with_casing

def test_all_schema_objects_with_casing(completer):
    text = 'SELECT * FROM '
    result = get_result(completer, text)
    assert completions_to_set(result) >= completions_to_set(
        [table(x) for x in ('Orders', '"select"', 'CUSTOM.shipments')]
        + [function(x + '()') for x in ('func2',)]
    )
开发者ID:dbcli,项目名称:pgcli,代码行数:7,代码来源:test_smart_completion_multiple_schemata.py

示例14: test_suggested_multiple_column_names_with_dot

def test_suggested_multiple_column_names_with_dot(completer):
    result = get_result(
        completer,
        'SELECT users.id, users. from users u',
        len('SELECT users.id, users.')
    )
    assert completions_to_set(result) == completions_to_set(
        testdata.columns('users'))
开发者ID:dbcli,项目名称:pgcli,代码行数:8,代码来源:test_smart_completion_public_schema_only.py

示例15: test_special_name_completion

def test_special_name_completion(completer, complete_event):
    text = '\\'
    position = len('\\')
    result = completions_to_set(completer.get_completions(
        Document(text=text, cursor_position=position),
        complete_event))
    # Special commands will NOT be suggested during naive completion mode.
    assert result == completions_to_set([])
开发者ID:dbcli,项目名称:pgcli,代码行数:8,代码来源:test_naive_completion.py


注:本文中的utils.completions_to_set函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。