Esempio n. 1
0
def test_index_based_completion_syntax_err():
    text = 'Foo'
    line = 'command "Pizza Foo'
    endidx = len(line)
    begidx = endidx - len(text)

    assert index_based_complete(text, line, begidx, endidx, index_dict) == []
Esempio n. 2
0
def test_index_based_completion_multiple():
    text = ''
    line = 'command Pizza '
    endidx = len(line)
    begidx = endidx - len(text)
    assert index_based_complete(text, line, begidx, endidx,
                                index_dict) == sorted(sport_item_strs)
Esempio n. 3
0
def test_index_based_completion_single_mid():
    text = 'Foo'
    line = 'command Pizza Foo'
    begidx = len(line) - len(text)
    endidx = begidx + 1

    assert index_based_complete(text, line, begidx, endidx,
                                index_dict) == ['Football']
Esempio n. 4
0
def test_index_based_callable_completer(request):
    test_dir = os.path.dirname(request.module.__file__)

    text = 'c'
    path = os.path.join(test_dir, text)
    line = 'command Pizza Bat {}'.format(path)

    endidx = len(line)
    begidx = endidx - len(text)

    assert index_based_complete(text, line, begidx, endidx,
                                index_dict) == ['conftest.py ']
Esempio n. 5
0
def test_index_based_completion_nomatch():
    text = 'q'
    line = 'command q'
    endidx = len(line)
    begidx = endidx - len(text)
    assert index_based_complete(text, line, begidx, endidx, index_dict) == []