def test_iter_iterable_param_completions( completer: ActionCompleter, action: types.Action, action_param: types.ActionParam, complete_event: CompleteEvent, start_position: int, ): completions = list( completer._iter_iterable_param_completions( action, action_param, "", complete_event, start_position=start_position)) assert len(completions) == len(action_param.source) # type: ignore for completion, source in zip(completions, action_param.source): # type: ignore assert completion.text == source assert completion.start_position == start_position
def test_iter_iterable_param_completions_partial_text( completer: ActionCompleter, action: types.Action, action_param: types.ActionParam, param_value: str, complete_event: CompleteEvent, start_position: int, ): completions = list( completer._iter_iterable_param_completions( action, action_param, param_value, complete_event, start_position=start_position, )) assert len(completions) == 1 first_completion, *_ = completions assert first_completion.text == "foo" assert first_completion.start_position == start_position