From dd97d5bc7e9754ec7018a44964e83450e9ff4f36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ab=C3=ADlio=20Costa?= Date: Wed, 9 Apr 2025 23:59:00 +0100 Subject: [PATCH] Move Whirlpool test and clean unused code (#142617) --- homeassistant/components/whirlpool/climate.py | 5 ----- tests/components/whirlpool/test_climate.py | 10 ---------- tests/components/whirlpool/test_config_flow.py | 2 +- tests/components/whirlpool/test_init.py | 10 ++++++++++ 4 files changed, 11 insertions(+), 16 deletions(-) diff --git a/homeassistant/components/whirlpool/climate.py b/homeassistant/components/whirlpool/climate.py index eb9e63efd44..6829dca3004 100644 --- a/homeassistant/components/whirlpool/climate.py +++ b/homeassistant/components/whirlpool/climate.py @@ -2,7 +2,6 @@ from __future__ import annotations -import logging from typing import Any from whirlpool.aircon import Aircon, FanSpeed as AirconFanSpeed, Mode as AirconMode @@ -26,9 +25,6 @@ from homeassistant.helpers.entity_platform import AddConfigEntryEntitiesCallback from . import WhirlpoolConfigEntry from .entity import WhirlpoolEntity -_LOGGER = logging.getLogger(__name__) - - AIRCON_MODE_MAP = { AirconMode.Cool: HVACMode.COOL, AirconMode.Heat: HVACMode.HEAT, @@ -75,7 +71,6 @@ class AirConEntity(WhirlpoolEntity, ClimateEntity): """Representation of an air conditioner.""" _attr_fan_modes = SUPPORTED_FAN_MODES - _attr_has_entity_name = True _attr_name = None _attr_hvac_modes = SUPPORTED_HVAC_MODES _attr_max_temp = SUPPORTED_MAX_TEMP diff --git a/tests/components/whirlpool/test_climate.py b/tests/components/whirlpool/test_climate.py index 1a076b76637..a273900151b 100644 --- a/tests/components/whirlpool/test_climate.py +++ b/tests/components/whirlpool/test_climate.py @@ -63,16 +63,6 @@ async def update_ac_state( return hass.states.get(entity_id) -async def test_no_appliances( - hass: HomeAssistant, mock_appliances_manager_api: MagicMock -) -> None: - """Test the setup of the climate entities when there are no appliances available.""" - mock_appliances_manager_api.return_value.aircons = [] - mock_appliances_manager_api.return_value.washer_dryers = [] - await init_integration(hass) - assert len(hass.states.async_all()) == 0 - - async def test_static_attributes( hass: HomeAssistant, entity_registry: er.EntityRegistry, diff --git a/tests/components/whirlpool/test_config_flow.py b/tests/components/whirlpool/test_config_flow.py index e01fbc07b51..0e277ee629b 100644 --- a/tests/components/whirlpool/test_config_flow.py +++ b/tests/components/whirlpool/test_config_flow.py @@ -135,7 +135,7 @@ async def test_form_auth_error( @pytest.mark.usefixtures("mock_auth_api", "mock_appliances_manager_api") async def test_form_already_configured(hass: HomeAssistant, region, brand) -> None: - """Test we handle cannot connect error.""" + """Test that configuring the integration twice with the same data fails.""" mock_entry = MockConfigEntry( domain=DOMAIN, data=CONFIG_INPUT | {"region": region[0], "brand": brand[0]}, diff --git a/tests/components/whirlpool/test_init.py b/tests/components/whirlpool/test_init.py index 5f04bf84b9e..06e82b74ba7 100644 --- a/tests/components/whirlpool/test_init.py +++ b/tests/components/whirlpool/test_init.py @@ -75,6 +75,16 @@ async def test_setup_brand_fallback( mock_backend_selector_api.assert_called_once_with(Brand.Whirlpool, region[1]) +async def test_setup_no_appliances( + hass: HomeAssistant, mock_appliances_manager_api: MagicMock +) -> None: + """Test setup when there are no appliances available.""" + mock_appliances_manager_api.return_value.aircons = [] + mock_appliances_manager_api.return_value.washer_dryers = [] + await init_integration(hass) + assert len(hass.states.async_all()) == 0 + + async def test_setup_http_exception( hass: HomeAssistant, mock_auth_api: MagicMock,