Repository: cookiecutter/cookiecutter
File: tests/test_prompt.py (Python)

Code before:

        assert not read_user_choice.called
        assert expected_choice == actual_choice

    def test_should_read_user_choice(self, mocker, choices, context) -> None:
        """Verify prompt_choice_for_config return user selection on no_input=False."""
        read_user_choice = mocker.patch('cookiecutter.prompt.read_user_choice')
        read_user_choice.return_value = 'all'

        expected_choice = 'all'

        actual_choice = prompt.prompt_choice_for_config(
            cookiecutter_dict=context,
            env=environment.StrictEnvironment(),
            key='orientation',
            options=choices,
            no_input=False,  # Ask the user for input
        )
        read_user_choice.assert_called_once_with('orientation', choices, None, '')
        assert expected_choice == actual_choice

    def test_empty_list_returns_empty_string(self) -> None:
        """Verify empty list returns empty string."""
        context = {'project': 'foobar'}
        with pytest.raises(ValueError):
            actual_choice = prompt.prompt_choice_for_config(
                cookiecutter_dict=context,
                env=environment.StrictEnvironment(),
                key='orientation',
                options=[],
                no_input=True,  # Suppress user input
            )


class TestReadUserYesNo:
    """Class to unite boolean prompt related tests."""

    @pytest.mark.parametrize(
        'run_as_docker',
        (
            True,
            False,
        ),
    )
    def test_should_invoke_read_user_yes_no(self, mocker, run_as_docker) -> None:
        """Verify correct function called for boolean variables."""
        read_user_yes_no = mocker.patch('cookiecutter.prompt.read_user_yes_no')
        read_user_yes_no.return_value = run_as_docker

        read_user_variable = mocker.patch('cookiecutter.prompt.read_user_variable')


Review comment (suggestion):
```suggestion
            prompt.prompt_choice_for_config(
```

Code after:

        assert not read_user_choice.called
        assert expected_choice == actual_choice

    def test_should_read_user_choice(self, mocker, choices, context) -> None:
        """Verify prompt_choice_for_config return user selection on no_input=False."""
        read_user_choice = mocker.patch('cookiecutter.prompt.read_user_choice')
        read_user_choice.return_value = 'all'

        expected_choice = 'all'

        actual_choice = prompt.prompt_choice_for_config(
            cookiecutter_dict=context,
            env=environment.StrictEnvironment(),
            key='orientation',
            options=choices,
            no_input=False,  # Ask the user for input
        )
        read_user_choice.assert_called_once_with('orientation', choices, None, '')
        assert expected_choice == actual_choice

    def test_empty_list_returns_empty_string(self) -> None:
        """Verify empty list returns empty string."""
        context = {'project': 'foobar'}
        with pytest.raises(ValueError):
            prompt.prompt_choice_for_config(
                cookiecutter_dict=context,
                env=environment.StrictEnvironment(),
                key='orientation',
                options=[],
                no_input=True,  # Suppress user input
            )


class TestReadUserYesNo:
    """Class to unite boolean prompt related tests."""

    @pytest.mark.parametrize(
        'run_as_docker',
        (
            True,
            False,
        ),
    )
    def test_should_invoke_read_user_yes_no(self, mocker, run_as_docker) -> None:
        """Verify correct function called for boolean variables."""
        read_user_yes_no = mocker.patch('cookiecutter.prompt.read_user_yes_no')
        read_user_yes_no.return_value = run_as_docker

        read_user_variable = mocker.patch('cookiecutter.prompt.read_user_variable')