From aa969d5ae830faec98e918a7a2e6d99c81d825e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Sat, 2 Apr 2022 10:01:49 +0200 Subject: [PATCH] Add missing typing to Airzone tests (#69097) --- tests/components/airzone/test_binary_sensor.py | 3 ++- tests/components/airzone/test_climate.py | 11 ++++++----- tests/components/airzone/test_config_flow.py | 7 ++++--- tests/components/airzone/test_coordinator.py | 2 +- tests/components/airzone/test_init.py | 3 ++- tests/components/airzone/test_sensor.py | 4 +++- tests/components/airzone/util.py | 2 +- 7 files changed, 19 insertions(+), 13 deletions(-) diff --git a/tests/components/airzone/test_binary_sensor.py b/tests/components/airzone/test_binary_sensor.py index ee3a8324ea4..13582a3c724 100644 --- a/tests/components/airzone/test_binary_sensor.py +++ b/tests/components/airzone/test_binary_sensor.py @@ -1,11 +1,12 @@ """The sensor tests for the Airzone platform.""" from homeassistant.const import STATE_OFF, STATE_ON +from homeassistant.core import HomeAssistant from .util import async_init_integration -async def test_airzone_create_binary_sensors(hass): +async def test_airzone_create_binary_sensors(hass: HomeAssistant) -> None: """Test creation of binary sensors.""" await async_init_integration(hass) diff --git a/tests/components/airzone/test_climate.py b/tests/components/airzone/test_climate.py index b06bb1f046f..107f0c32297 100644 --- a/tests/components/airzone/test_climate.py +++ b/tests/components/airzone/test_climate.py @@ -37,12 +37,13 @@ from homeassistant.components.climate.const import ( SERVICE_SET_TEMPERATURE, ) from homeassistant.const import ATTR_ENTITY_ID, ATTR_TEMPERATURE +from homeassistant.core import HomeAssistant from homeassistant.exceptions import HomeAssistantError from .util import async_init_integration -async def test_airzone_create_climates(hass): +async def test_airzone_create_climates(hass: HomeAssistant) -> None: """Test creation of climates.""" await async_init_integration(hass) @@ -133,7 +134,7 @@ async def test_airzone_create_climates(hass): assert state.attributes.get(ATTR_TEMPERATURE) == 19.1 -async def test_airzone_climate_set_hvac_mode(hass): +async def test_airzone_climate_set_hvac_mode(hass: HomeAssistant) -> None: """Test setting the HVAC mode.""" await async_init_integration(hass) @@ -192,7 +193,7 @@ async def test_airzone_climate_set_hvac_mode(hass): assert state.state == HVAC_MODE_OFF -async def test_airzone_climate_set_hvac_slave_error(hass): +async def test_airzone_climate_set_hvac_slave_error(hass: HomeAssistant) -> None: """Test setting the HVAC mode for a slave zone.""" HVAC_MOCK = { @@ -225,7 +226,7 @@ async def test_airzone_climate_set_hvac_slave_error(hass): assert state.state == HVAC_MODE_OFF -async def test_airzone_climate_set_temp(hass): +async def test_airzone_climate_set_temp(hass: HomeAssistant) -> None: """Test setting the target temperature.""" HVAC_MOCK = { @@ -258,7 +259,7 @@ async def test_airzone_climate_set_temp(hass): assert state.attributes.get(ATTR_TEMPERATURE) == 20.5 -async def test_airzone_climate_set_temp_error(hass): +async def test_airzone_climate_set_temp_error(hass: HomeAssistant) -> None: """Test error when setting the target temperature.""" await async_init_integration(hass) diff --git a/tests/components/airzone/test_config_flow.py b/tests/components/airzone/test_config_flow.py index 08eb35ef52b..8ffe10167ea 100644 --- a/tests/components/airzone/test_config_flow.py +++ b/tests/components/airzone/test_config_flow.py @@ -8,13 +8,14 @@ from homeassistant import data_entry_flow from homeassistant.components.airzone.const import DOMAIN from homeassistant.config_entries import SOURCE_USER, ConfigEntryState from homeassistant.const import CONF_HOST, CONF_PORT +from homeassistant.core import HomeAssistant from .util import CONFIG, HVAC_MOCK from tests.common import MockConfigEntry -async def test_form(hass): +async def test_form(hass: HomeAssistant) -> None: """Test that the form is served with valid input.""" with patch( @@ -56,7 +57,7 @@ async def test_form(hass): assert len(mock_setup_entry.mock_calls) == 1 -async def test_form_duplicated_id(hass): +async def test_form_duplicated_id(hass: HomeAssistant) -> None: """Test setting up duplicated entry.""" entry = MockConfigEntry(domain=DOMAIN, data=CONFIG) @@ -74,7 +75,7 @@ async def test_form_duplicated_id(hass): assert result["reason"] == "already_configured" -async def test_connection_error(hass): +async def test_connection_error(hass: HomeAssistant): """Test connection to host error.""" with patch( diff --git a/tests/components/airzone/test_coordinator.py b/tests/components/airzone/test_coordinator.py index 00ef0616b3e..179e94355c0 100644 --- a/tests/components/airzone/test_coordinator.py +++ b/tests/components/airzone/test_coordinator.py @@ -15,7 +15,7 @@ from .util import CONFIG, HVAC_MOCK from tests.common import MockConfigEntry, async_fire_time_changed -async def test_coordinator_client_connector_error(hass: HomeAssistant): +async def test_coordinator_client_connector_error(hass: HomeAssistant) -> None: """Test ClientConnectorError on coordinator update.""" entry = MockConfigEntry(domain=DOMAIN, data=CONFIG) diff --git a/tests/components/airzone/test_init.py b/tests/components/airzone/test_init.py index 30e3ce37d6f..ce08a17ec6c 100644 --- a/tests/components/airzone/test_init.py +++ b/tests/components/airzone/test_init.py @@ -4,13 +4,14 @@ from unittest.mock import patch from homeassistant.components.airzone.const import DOMAIN from homeassistant.config_entries import ConfigEntryState +from homeassistant.core import HomeAssistant from .util import CONFIG, HVAC_MOCK from tests.common import MockConfigEntry -async def test_unload_entry(hass): +async def test_unload_entry(hass: HomeAssistant) -> None: """Test unload.""" config_entry = MockConfigEntry( diff --git a/tests/components/airzone/test_sensor.py b/tests/components/airzone/test_sensor.py index fc03d8a3301..c68be2abbab 100644 --- a/tests/components/airzone/test_sensor.py +++ b/tests/components/airzone/test_sensor.py @@ -1,9 +1,11 @@ """The sensor tests for the Airzone platform.""" +from homeassistant.core import HomeAssistant + from .util import async_init_integration -async def test_airzone_create_sensors(hass): +async def test_airzone_create_sensors(hass: HomeAssistant) -> None: """Test creation of sensors.""" await async_init_integration(hass) diff --git a/tests/components/airzone/util.py b/tests/components/airzone/util.py index 2f7afb068b3..f533870550d 100644 --- a/tests/components/airzone/util.py +++ b/tests/components/airzone/util.py @@ -150,7 +150,7 @@ HVAC_MOCK = { async def async_init_integration( hass: HomeAssistant, -): +) -> None: """Set up the Airzone integration in Home Assistant.""" entry = MockConfigEntry(domain=DOMAIN, data=CONFIG)