Add missing hass type hint in component tests (g) (#124203)
This commit is contained in:
parent
1fdcbc3f15
commit
25d33e96cc
7 changed files with 57 additions and 36 deletions
|
@ -40,11 +40,13 @@ from homeassistant.core import (
|
|||
DOMAIN as HOMEASSISTANT_DOMAIN,
|
||||
CoreState,
|
||||
HomeAssistant,
|
||||
ServiceCall,
|
||||
State,
|
||||
callback,
|
||||
)
|
||||
from homeassistant.exceptions import ServiceValidationError
|
||||
from homeassistant.helpers import device_registry as dr, entity_registry as er
|
||||
from homeassistant.helpers.typing import StateType
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util import dt as dt_util
|
||||
from homeassistant.util.unit_system import METRIC_SYSTEM, US_CUSTOMARY_SYSTEM
|
||||
|
@ -208,7 +210,7 @@ async def test_unique_id(
|
|||
assert entry.unique_id == unique_id
|
||||
|
||||
|
||||
def _setup_sensor(hass, temp):
|
||||
def _setup_sensor(hass: HomeAssistant, temp: StateType) -> None:
|
||||
"""Set up the test sensor."""
|
||||
hass.states.async_set(ENT_SENSOR, temp)
|
||||
|
||||
|
@ -594,13 +596,13 @@ async def test_hvac_mode_heat(hass: HomeAssistant) -> None:
|
|||
assert call.data["entity_id"] == ENT_SWITCH
|
||||
|
||||
|
||||
def _setup_switch(hass, is_on):
|
||||
def _setup_switch(hass: HomeAssistant, is_on: bool) -> list[ServiceCall]:
|
||||
"""Set up the test switch."""
|
||||
hass.states.async_set(ENT_SWITCH, STATE_ON if is_on else STATE_OFF)
|
||||
calls = []
|
||||
|
||||
@callback
|
||||
def log_call(call):
|
||||
def log_call(call: ServiceCall) -> None:
|
||||
"""Log service calls."""
|
||||
calls.append(call)
|
||||
|
||||
|
@ -1374,7 +1376,7 @@ async def test_restore_state_uncoherence_case(hass: HomeAssistant) -> None:
|
|||
assert state.state == HVACMode.OFF
|
||||
|
||||
|
||||
async def _setup_climate(hass):
|
||||
async def _setup_climate(hass: HomeAssistant) -> None:
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
DOMAIN,
|
||||
|
@ -1393,7 +1395,9 @@ async def _setup_climate(hass):
|
|||
)
|
||||
|
||||
|
||||
def _mock_restore_cache(hass, temperature=20, hvac_mode=HVACMode.OFF):
|
||||
def _mock_restore_cache(
|
||||
hass: HomeAssistant, temperature: int = 20, hvac_mode: HVACMode = HVACMode.OFF
|
||||
) -> None:
|
||||
mock_restore_cache(
|
||||
hass,
|
||||
(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue