Add type hints to integration tests (j-m) (#87704)

This commit is contained in:
epenet 2023-02-08 19:06:59 +01:00 committed by GitHub
parent 630028106a
commit f75ac17554
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
103 changed files with 605 additions and 417 deletions

View file

@ -12,6 +12,7 @@ from homeassistant.components.climate import (
from homeassistant.components.melissa import DATA_MELISSA, climate as melissa
from homeassistant.components.melissa.climate import MelissaClimate
from homeassistant.const import ATTR_TEMPERATURE, UnitOfTemperature
from homeassistant.core import HomeAssistant
from tests.common import load_fixture
@ -55,7 +56,7 @@ def melissa_mock():
return api
async def test_setup_platform(hass):
async def test_setup_platform(hass: HomeAssistant) -> None:
"""Test setup_platform."""
with patch(
"homeassistant.components.melissa.climate.MelissaClimate"
@ -75,7 +76,7 @@ async def test_setup_platform(hass):
add_entities.assert_called_once_with(thermostats)
async def test_get_name(hass):
async def test_get_name(hass: HomeAssistant) -> None:
"""Test name property."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -84,7 +85,7 @@ async def test_get_name(hass):
assert thermostat.name == "Melissa 12345678"
async def test_current_fan_mode(hass):
async def test_current_fan_mode(hass: HomeAssistant) -> None:
"""Test current_fan_mode property."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -97,7 +98,7 @@ async def test_current_fan_mode(hass):
assert thermostat.fan_mode is None
async def test_current_temperature(hass):
async def test_current_temperature(hass: HomeAssistant) -> None:
"""Test current temperature."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -106,7 +107,7 @@ async def test_current_temperature(hass):
assert thermostat.current_temperature == 27.4
async def test_current_temperature_no_data(hass):
async def test_current_temperature_no_data(hass: HomeAssistant) -> None:
"""Test current temperature without data."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -116,7 +117,7 @@ async def test_current_temperature_no_data(hass):
assert thermostat.current_temperature is None
async def test_target_temperature_step(hass):
async def test_target_temperature_step(hass: HomeAssistant) -> None:
"""Test current target_temperature_step."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -125,7 +126,7 @@ async def test_target_temperature_step(hass):
assert thermostat.target_temperature_step == 1
async def test_current_operation(hass):
async def test_current_operation(hass: HomeAssistant) -> None:
"""Test current operation."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -138,7 +139,7 @@ async def test_current_operation(hass):
assert thermostat.hvac_action is None
async def test_operation_list(hass):
async def test_operation_list(hass: HomeAssistant) -> None:
"""Test the operation list."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -153,7 +154,7 @@ async def test_operation_list(hass):
] == thermostat.hvac_modes
async def test_fan_modes(hass):
async def test_fan_modes(hass: HomeAssistant) -> None:
"""Test the fan list."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -162,7 +163,7 @@ async def test_fan_modes(hass):
assert ["auto", FAN_HIGH, FAN_MEDIUM, FAN_LOW] == thermostat.fan_modes
async def test_target_temperature(hass):
async def test_target_temperature(hass: HomeAssistant) -> None:
"""Test target temperature."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -175,7 +176,7 @@ async def test_target_temperature(hass):
assert thermostat.target_temperature is None
async def test_state(hass):
async def test_state(hass: HomeAssistant) -> None:
"""Test state."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -188,7 +189,7 @@ async def test_state(hass):
assert thermostat.state is None
async def test_temperature_unit(hass):
async def test_temperature_unit(hass: HomeAssistant) -> None:
"""Test temperature unit."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -197,7 +198,7 @@ async def test_temperature_unit(hass):
assert thermostat.temperature_unit == UnitOfTemperature.CELSIUS
async def test_min_temp(hass):
async def test_min_temp(hass: HomeAssistant) -> None:
"""Test min temp."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -206,7 +207,7 @@ async def test_min_temp(hass):
assert thermostat.min_temp == 16
async def test_max_temp(hass):
async def test_max_temp(hass: HomeAssistant) -> None:
"""Test max temp."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -215,7 +216,7 @@ async def test_max_temp(hass):
assert thermostat.max_temp == 30
async def test_supported_features(hass):
async def test_supported_features(hass: HomeAssistant) -> None:
"""Test supported_features property."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -227,7 +228,7 @@ async def test_supported_features(hass):
assert thermostat.supported_features == features
async def test_set_temperature(hass):
async def test_set_temperature(hass: HomeAssistant) -> None:
"""Test set_temperature."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -238,7 +239,7 @@ async def test_set_temperature(hass):
assert thermostat.target_temperature == 25
async def test_fan_mode(hass):
async def test_fan_mode(hass: HomeAssistant) -> None:
"""Test set_fan_mode."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -251,7 +252,7 @@ async def test_fan_mode(hass):
assert thermostat.fan_mode == FAN_HIGH
async def test_set_operation_mode(hass):
async def test_set_operation_mode(hass: HomeAssistant) -> None:
"""Test set_operation_mode."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -264,7 +265,7 @@ async def test_set_operation_mode(hass):
assert thermostat.hvac_mode == HVACMode.COOL
async def test_send(hass):
async def test_send(hass: HomeAssistant) -> None:
"""Test send."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -283,7 +284,7 @@ async def test_send(hass):
assert thermostat._cur_settings is None
async def test_update(hass):
async def test_update(hass: HomeAssistant) -> None:
"""Test update."""
with patch(
"homeassistant.components.melissa.climate._LOGGER.warning"
@ -301,7 +302,7 @@ async def test_update(hass):
)
async def test_melissa_op_to_hass(hass):
async def test_melissa_op_to_hass(hass: HomeAssistant) -> None:
"""Test for translate melissa operations to hass."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -314,7 +315,7 @@ async def test_melissa_op_to_hass(hass):
assert thermostat.melissa_op_to_hass(5) is None
async def test_melissa_fan_to_hass(hass):
async def test_melissa_fan_to_hass(hass: HomeAssistant) -> None:
"""Test for translate melissa fan state to hass."""
with patch("homeassistant.components.melissa"):
api = melissa_mock()
@ -327,7 +328,7 @@ async def test_melissa_fan_to_hass(hass):
assert thermostat.melissa_fan_to_hass(4) is None
async def test_hass_mode_to_melissa(hass):
async def test_hass_mode_to_melissa(hass: HomeAssistant) -> None:
"""Test for hass operations to melssa."""
with patch(
"homeassistant.components.melissa.climate._LOGGER.warning"
@ -345,7 +346,7 @@ async def test_hass_mode_to_melissa(hass):
)
async def test_hass_fan_to_melissa(hass):
async def test_hass_fan_to_melissa(hass: HomeAssistant) -> None:
"""Test for translate melissa states to hass."""
with patch(
"homeassistant.components.melissa.climate._LOGGER.warning"