Add type hints to integration tests (part 9) (#87983)
This commit is contained in:
parent
6359775cfc
commit
03710e58b5
63 changed files with 1526 additions and 781 deletions
|
@ -9,6 +9,7 @@ from homeassistant.components.light import (
|
|||
ColorMode,
|
||||
)
|
||||
from homeassistant.const import ATTR_SUPPORTED_FEATURES, STATE_UNAVAILABLE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from .common import get_next_aid, setup_test_component
|
||||
|
@ -53,7 +54,7 @@ def create_lightbulb_service_with_color_temp(accessory):
|
|||
return service
|
||||
|
||||
|
||||
async def test_switch_change_light_state(hass, utcnow):
|
||||
async def test_switch_change_light_state(hass: HomeAssistant, utcnow) -> None:
|
||||
"""Test that we can turn a HomeKit light on and off again."""
|
||||
helper = await setup_test_component(hass, create_lightbulb_service_with_hs)
|
||||
|
||||
|
@ -84,7 +85,9 @@ async def test_switch_change_light_state(hass, utcnow):
|
|||
)
|
||||
|
||||
|
||||
async def test_switch_change_light_state_color_temp(hass, utcnow):
|
||||
async def test_switch_change_light_state_color_temp(
|
||||
hass: HomeAssistant, utcnow
|
||||
) -> None:
|
||||
"""Test that we can turn change color_temp."""
|
||||
helper = await setup_test_component(hass, create_lightbulb_service_with_color_temp)
|
||||
|
||||
|
@ -104,7 +107,7 @@ async def test_switch_change_light_state_color_temp(hass, utcnow):
|
|||
)
|
||||
|
||||
|
||||
async def test_switch_read_light_state_dimmer(hass, utcnow):
|
||||
async def test_switch_read_light_state_dimmer(hass: HomeAssistant, utcnow) -> None:
|
||||
"""Test that we can read the state of a HomeKit light accessory."""
|
||||
helper = await setup_test_component(hass, create_lightbulb_service)
|
||||
|
||||
|
@ -139,7 +142,7 @@ async def test_switch_read_light_state_dimmer(hass, utcnow):
|
|||
assert state.state == "off"
|
||||
|
||||
|
||||
async def test_switch_push_light_state_dimmer(hass, utcnow):
|
||||
async def test_switch_push_light_state_dimmer(hass: HomeAssistant, utcnow) -> None:
|
||||
"""Test that we can read the state of a HomeKit light accessory."""
|
||||
helper = await setup_test_component(hass, create_lightbulb_service)
|
||||
|
||||
|
@ -167,7 +170,7 @@ async def test_switch_push_light_state_dimmer(hass, utcnow):
|
|||
assert state.state == "off"
|
||||
|
||||
|
||||
async def test_switch_read_light_state_hs(hass, utcnow):
|
||||
async def test_switch_read_light_state_hs(hass: HomeAssistant, utcnow) -> None:
|
||||
"""Test that we can read the state of a HomeKit light accessory."""
|
||||
helper = await setup_test_component(hass, create_lightbulb_service_with_hs)
|
||||
|
||||
|
@ -205,7 +208,7 @@ async def test_switch_read_light_state_hs(hass, utcnow):
|
|||
assert state.state == "off"
|
||||
|
||||
|
||||
async def test_switch_push_light_state_hs(hass, utcnow):
|
||||
async def test_switch_push_light_state_hs(hass: HomeAssistant, utcnow) -> None:
|
||||
"""Test that we can read the state of a HomeKit light accessory."""
|
||||
helper = await setup_test_component(hass, create_lightbulb_service_with_hs)
|
||||
|
||||
|
@ -236,7 +239,7 @@ async def test_switch_push_light_state_hs(hass, utcnow):
|
|||
assert state.state == "off"
|
||||
|
||||
|
||||
async def test_switch_read_light_state_color_temp(hass, utcnow):
|
||||
async def test_switch_read_light_state_color_temp(hass: HomeAssistant, utcnow) -> None:
|
||||
"""Test that we can read the color_temp of a light accessory."""
|
||||
helper = await setup_test_component(hass, create_lightbulb_service_with_color_temp)
|
||||
|
||||
|
@ -264,7 +267,7 @@ async def test_switch_read_light_state_color_temp(hass, utcnow):
|
|||
assert state.attributes[ATTR_SUPPORTED_FEATURES] == 0
|
||||
|
||||
|
||||
async def test_switch_push_light_state_color_temp(hass, utcnow):
|
||||
async def test_switch_push_light_state_color_temp(hass: HomeAssistant, utcnow) -> None:
|
||||
"""Test that we can read the state of a HomeKit light accessory."""
|
||||
helper = await setup_test_component(hass, create_lightbulb_service_with_color_temp)
|
||||
|
||||
|
@ -285,7 +288,9 @@ async def test_switch_push_light_state_color_temp(hass, utcnow):
|
|||
assert state.attributes["color_temp"] == 400
|
||||
|
||||
|
||||
async def test_light_becomes_unavailable_but_recovers(hass, utcnow):
|
||||
async def test_light_becomes_unavailable_but_recovers(
|
||||
hass: HomeAssistant, utcnow
|
||||
) -> None:
|
||||
"""Test transition to and from unavailable state."""
|
||||
helper = await setup_test_component(hass, create_lightbulb_service_with_color_temp)
|
||||
|
||||
|
@ -313,7 +318,7 @@ async def test_light_becomes_unavailable_but_recovers(hass, utcnow):
|
|||
assert state.attributes["color_temp"] == 400
|
||||
|
||||
|
||||
async def test_light_unloaded_removed(hass, utcnow):
|
||||
async def test_light_unloaded_removed(hass: HomeAssistant, utcnow) -> None:
|
||||
"""Test entity and HKDevice are correctly unloaded and removed."""
|
||||
helper = await setup_test_component(hass, create_lightbulb_service_with_color_temp)
|
||||
|
||||
|
@ -338,7 +343,7 @@ async def test_light_unloaded_removed(hass, utcnow):
|
|||
assert hass.states.get(helper.entity_id).state == STATE_UNAVAILABLE
|
||||
|
||||
|
||||
async def test_migrate_unique_id(hass, utcnow):
|
||||
async def test_migrate_unique_id(hass: HomeAssistant, utcnow) -> None:
|
||||
"""Test a we can migrate a light unique id."""
|
||||
entity_registry = er.async_get(hass)
|
||||
aid = get_next_aid()
|
||||
|
@ -355,7 +360,7 @@ async def test_migrate_unique_id(hass, utcnow):
|
|||
)
|
||||
|
||||
|
||||
async def test_only_migrate_once(hass, utcnow):
|
||||
async def test_only_migrate_once(hass: HomeAssistant, utcnow) -> None:
|
||||
"""Test a we handle migration happening after an upgrade and than a downgrade and then an upgrade."""
|
||||
entity_registry = er.async_get(hass)
|
||||
aid = get_next_aid()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue