Repository: kedro-org/kedro
File: tests/framework/cli/test_starters.py (Python)

Code before:
    def test_convert_tool_short_names_to_numbers_with_case_insensitive_tools(self):
        selected_tools = "Lint,TEST,Docs"
        result = _convert_tool_short_names_to_numbers(selected_tools)
        assert result == ["1", "2", "4"]

    def test_convert_tool_short_names_to_numbers_with_invalid_tools(self):
        selected_tools = "invalid_tool1,invalid_tool2"
        result = _convert_tool_short_names_to_numbers(selected_tools)
        assert result == []

    def test_convert_tool_short_names_to_numbers_with_duplicates(self):
        selected_tools = "lint,test,tests"
        result = _convert_tool_short_names_to_numbers(selected_tools)
        assert result == ["1", "2"]


@pytest.mark.usefixtures("chdir_to_tmp")
class TestTelemetryCLIFlag:
    @pytest.mark.parametrize(
        "input",
        ["yes", "YES", "y", "Y", "yEs"],
    )
    def test_flag_value_is_yes(self, fake_kedro_cli, input):
        result = CliRunner().invoke(
            fake_kedro_cli,
            [
                "new",
                "--name",
                "New Kedro Project",
                "--tools",
                "none",
                "--example",
                "no",
                "--telemetry",
                input,
            ],
        )

        repo_name = "new-kedro-project"
        assert result.exit_code == 0

        telemetry_file_path = Path(repo_name + "/.telemetry")
        assert telemetry_file_path.exists()

        with open(telemetry_file_path) as file:
            file_content = file.read()
            target_string = "consent: true"

        assert target_string in file_content
        _clean_up_project(Path("./" + repo_name))


Review comment (suggestion):
`test_starters` is becoming so long 🥲  Might be time to prioritise: https://github.com/kedro-org/kedro/issues/3594

Code after:
        selected_tools = "lint,invalid_tool,docs"
        result = _convert_tool_short_names_to_numbers(selected_tools)
        assert result == ["1", "4"]

    def test_convert_tool_short_names_to_numbers_with_whitespace(self):
        selected_tools = " lint , test , docs "
        result = _convert_tool_short_names_to_numbers(selected_tools)
        assert result == ["1", "2", "4"]

    def test_convert_tool_short_names_to_numbers_with_case_insensitive_tools(self):
        selected_tools = "Lint,TEST,Docs"
        result = _convert_tool_short_names_to_numbers(selected_tools)
        assert result == ["1", "2", "4"]

    def test_convert_tool_short_names_to_numbers_with_invalid_tools(self):
        selected_tools = "invalid_tool1,invalid_tool2"
        result = _convert_tool_short_names_to_numbers(selected_tools)
        assert result == []

    def test_convert_tool_short_names_to_numbers_with_duplicates(self):
        selected_tools = "lint,test,tests"
        result = _convert_tool_short_names_to_numbers(selected_tools)
        assert result == ["1", "2"]


@pytest.mark.usefixtures("chdir_to_tmp")
class TestTelemetryCLIFlag:
    @pytest.mark.parametrize(
        "input",
        ["yes", "YES", "y", "Y", "yEs"],
    )
    def test_flag_value_is_yes(self, fake_kedro_cli, input):
        result = CliRunner().invoke(
            fake_kedro_cli,
            [
                "new",
                "--name",
                "New Kedro Project",
                "--tools",
                "none",
                "--example",
                "no",
                "--telemetry",
                input,
            ],
        )

        repo_name = "new-kedro-project"
        assert result.exit_code == 0

        telemetry_file_path = Path(repo_name + "/.telemetry")