示例#1
0
def test_quote_handling(command_context, completions, lprefix):
    bash_completions, bash_lprefix = complete_from_bash(
        CompletionContext(command_context))
    assert bash_completions == completions and bash_lprefix == lprefix
    assert all(
        isinstance(comp, RichCompletion) and not comp.append_closing_quote
        for comp in bash_completions
    )  # make sure the completer handles the closing quote by itself
示例#2
0
def test_equal_sign_arg(command_context, completions, lprefix,
                        exp_append_space):
    bash_completions, bash_lprefix = complete_from_bash(
        CompletionContext(command_context))
    assert bash_completions == completions and bash_lprefix == lprefix
    assert all(
        isinstance(comp, RichCompletion)
        and comp.append_space == exp_append_space for comp in bash_completions)
示例#3
0
def test_bash_completer(command_context, completions, lprefix):
    bash_completions, bash_lprefix = complete_from_bash(
        CompletionContext(command_context))
    assert bash_completions == completions and bash_lprefix == lprefix
示例#4
0
def test_bash_completer_empty_prefix():
    context = CompletionContext(
        CommandContext(args=(CommandArg("git"), ), arg_index=1, prefix=""))
    bash_completions, bash_lprefix = complete_from_bash(context)
    assert {"clean", "show"}.issubset(bash_completions)