mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 21:06:19 +00:00
Add type hints to integration tests (part 3) (#87844)
This commit is contained in:
@@ -6,7 +6,12 @@ import homeassistant.components.automation as automation
|
||||
from homeassistant.components.climate import DOMAIN, HVACMode, const, device_condition
|
||||
from homeassistant.components.device_automation import DeviceAutomationType
|
||||
from homeassistant.const import EntityCategory
|
||||
from homeassistant.helpers import config_validation as cv, device_registry as dr
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import (
|
||||
config_validation as cv,
|
||||
device_registry as dr,
|
||||
entity_registry as er,
|
||||
)
|
||||
from homeassistant.helpers.entity_registry import RegistryEntryHider
|
||||
from homeassistant.setup import async_setup_component
|
||||
|
||||
@@ -45,14 +50,14 @@ def calls(hass):
|
||||
],
|
||||
)
|
||||
async def test_get_conditions(
|
||||
hass,
|
||||
device_registry,
|
||||
entity_registry,
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
set_state,
|
||||
features_reg,
|
||||
features_state,
|
||||
expected_condition_types,
|
||||
):
|
||||
) -> None:
|
||||
"""Test we get the expected conditions from a climate."""
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
@@ -99,12 +104,12 @@ async def test_get_conditions(
|
||||
),
|
||||
)
|
||||
async def test_get_conditions_hidden_auxiliary(
|
||||
hass,
|
||||
device_registry,
|
||||
entity_registry,
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
hidden_by,
|
||||
entity_category,
|
||||
):
|
||||
) -> None:
|
||||
"""Test we get the expected conditions from a hidden or auxiliary entity."""
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
@@ -137,7 +142,7 @@ async def test_get_conditions_hidden_auxiliary(
|
||||
assert_lists_same(conditions, expected_conditions)
|
||||
|
||||
|
||||
async def test_if_state(hass, calls):
|
||||
async def test_if_state(hass: HomeAssistant, calls) -> None:
|
||||
"""Test for turn_on and turn_off conditions."""
|
||||
assert await async_setup_component(
|
||||
hass,
|
||||
@@ -305,15 +310,15 @@ async def test_if_state(hass, calls):
|
||||
],
|
||||
)
|
||||
async def test_capabilities(
|
||||
hass,
|
||||
device_registry,
|
||||
entity_registry,
|
||||
hass: HomeAssistant,
|
||||
device_registry: dr.DeviceRegistry,
|
||||
entity_registry: er.EntityRegistry,
|
||||
set_state,
|
||||
capabilities_reg,
|
||||
capabilities_state,
|
||||
condition,
|
||||
expected_capabilities,
|
||||
):
|
||||
) -> None:
|
||||
"""Test getting capabilities."""
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
@@ -360,7 +365,9 @@ async def test_capabilities(
|
||||
"condition,capability_name",
|
||||
[("is_hvac_mode", "hvac_mode"), ("is_preset_mode", "preset_mode")],
|
||||
)
|
||||
async def test_capabilities_missing_entity(hass, condition, capability_name):
|
||||
async def test_capabilities_missing_entity(
|
||||
hass: HomeAssistant, condition, capability_name
|
||||
) -> None:
|
||||
"""Test getting capabilities."""
|
||||
config_entry = MockConfigEntry(domain="test", data={})
|
||||
config_entry.add_to_hass(hass)
|
||||
|
||||
Reference in New Issue
Block a user