def test_iter_group_completions(
    completer: ActionCompleter,
    group: types.ActionGroup,
    fragments: List[str],
    complete_event: CompleteEvent,
    start_position: int,
):
    with patch.object(
            completer, "_build_completion",
            wraps=completer._build_completion) as mock_build_completion:
        for completion in list(
                completer._iter_group_completions(
                    group,
                    fragments,
                    complete_event,
                    start_position=start_position)):
            assert isinstance(completion, Completion)
            assert completion.start_position == start_position

            for child in group.children.values():
                mock_build_completion.assert_called_with(
                    completable=child,
                    text="test",
                    start_position=start_position,
                )
def test_iter_group_completions_skips_inactive_sources(
    completer: ActionCompleter,
    group: types.ActionGroup,
    fragments: List[str],
    complete_event: CompleteEvent,
    start_position: int,
):
    assert (len(
        list(
            completer._iter_group_completions(
                group,
                fragments,
                complete_event,
                start_position=start_position))) == 0)