Add missing typing to Airzone tests (#69097)

This commit is contained in:
Álvaro Fernández Rojas 2022-04-02 10:01:49 +02:00 committed by GitHub
parent 912923f55d
commit aa969d5ae8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 13 deletions

View File

@ -1,11 +1,12 @@
"""The sensor tests for the Airzone platform.""" """The sensor tests for the Airzone platform."""
from homeassistant.const import STATE_OFF, STATE_ON from homeassistant.const import STATE_OFF, STATE_ON
from homeassistant.core import HomeAssistant
from .util import async_init_integration 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.""" """Test creation of binary sensors."""
await async_init_integration(hass) await async_init_integration(hass)

View File

@ -37,12 +37,13 @@ from homeassistant.components.climate.const import (
SERVICE_SET_TEMPERATURE, SERVICE_SET_TEMPERATURE,
) )
from homeassistant.const import ATTR_ENTITY_ID, ATTR_TEMPERATURE from homeassistant.const import ATTR_ENTITY_ID, ATTR_TEMPERATURE
from homeassistant.core import HomeAssistant
from homeassistant.exceptions import HomeAssistantError from homeassistant.exceptions import HomeAssistantError
from .util import async_init_integration 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.""" """Test creation of climates."""
await async_init_integration(hass) await async_init_integration(hass)
@ -133,7 +134,7 @@ async def test_airzone_create_climates(hass):
assert state.attributes.get(ATTR_TEMPERATURE) == 19.1 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.""" """Test setting the HVAC mode."""
await async_init_integration(hass) await async_init_integration(hass)
@ -192,7 +193,7 @@ async def test_airzone_climate_set_hvac_mode(hass):
assert state.state == HVAC_MODE_OFF 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.""" """Test setting the HVAC mode for a slave zone."""
HVAC_MOCK = { HVAC_MOCK = {
@ -225,7 +226,7 @@ async def test_airzone_climate_set_hvac_slave_error(hass):
assert state.state == HVAC_MODE_OFF 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.""" """Test setting the target temperature."""
HVAC_MOCK = { HVAC_MOCK = {
@ -258,7 +259,7 @@ async def test_airzone_climate_set_temp(hass):
assert state.attributes.get(ATTR_TEMPERATURE) == 20.5 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.""" """Test error when setting the target temperature."""
await async_init_integration(hass) await async_init_integration(hass)

View File

@ -8,13 +8,14 @@ from homeassistant import data_entry_flow
from homeassistant.components.airzone.const import DOMAIN from homeassistant.components.airzone.const import DOMAIN
from homeassistant.config_entries import SOURCE_USER, ConfigEntryState from homeassistant.config_entries import SOURCE_USER, ConfigEntryState
from homeassistant.const import CONF_HOST, CONF_PORT from homeassistant.const import CONF_HOST, CONF_PORT
from homeassistant.core import HomeAssistant
from .util import CONFIG, HVAC_MOCK from .util import CONFIG, HVAC_MOCK
from tests.common import MockConfigEntry 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.""" """Test that the form is served with valid input."""
with patch( with patch(
@ -56,7 +57,7 @@ async def test_form(hass):
assert len(mock_setup_entry.mock_calls) == 1 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.""" """Test setting up duplicated entry."""
entry = MockConfigEntry(domain=DOMAIN, data=CONFIG) entry = MockConfigEntry(domain=DOMAIN, data=CONFIG)
@ -74,7 +75,7 @@ async def test_form_duplicated_id(hass):
assert result["reason"] == "already_configured" assert result["reason"] == "already_configured"
async def test_connection_error(hass): async def test_connection_error(hass: HomeAssistant):
"""Test connection to host error.""" """Test connection to host error."""
with patch( with patch(

View File

@ -15,7 +15,7 @@ from .util import CONFIG, HVAC_MOCK
from tests.common import MockConfigEntry, async_fire_time_changed 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.""" """Test ClientConnectorError on coordinator update."""
entry = MockConfigEntry(domain=DOMAIN, data=CONFIG) entry = MockConfigEntry(domain=DOMAIN, data=CONFIG)

View File

@ -4,13 +4,14 @@ from unittest.mock import patch
from homeassistant.components.airzone.const import DOMAIN from homeassistant.components.airzone.const import DOMAIN
from homeassistant.config_entries import ConfigEntryState from homeassistant.config_entries import ConfigEntryState
from homeassistant.core import HomeAssistant
from .util import CONFIG, HVAC_MOCK from .util import CONFIG, HVAC_MOCK
from tests.common import MockConfigEntry from tests.common import MockConfigEntry
async def test_unload_entry(hass): async def test_unload_entry(hass: HomeAssistant) -> None:
"""Test unload.""" """Test unload."""
config_entry = MockConfigEntry( config_entry = MockConfigEntry(

View File

@ -1,9 +1,11 @@
"""The sensor tests for the Airzone platform.""" """The sensor tests for the Airzone platform."""
from homeassistant.core import HomeAssistant
from .util import async_init_integration 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.""" """Test creation of sensors."""
await async_init_integration(hass) await async_init_integration(hass)

View File

@ -150,7 +150,7 @@ HVAC_MOCK = {
async def async_init_integration( async def async_init_integration(
hass: HomeAssistant, hass: HomeAssistant,
): ) -> None:
"""Set up the Airzone integration in Home Assistant.""" """Set up the Airzone integration in Home Assistant."""
entry = MockConfigEntry(domain=DOMAIN, data=CONFIG) entry = MockConfigEntry(domain=DOMAIN, data=CONFIG)