mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Add type hints to integration tests (a) (#87684)
* Add type hints to accuweather tests * Adjust a** components * Adjust aiohttp_client * ClientSessionGenerator/WebSocketGenerator
This commit is contained in:
@@ -27,6 +27,7 @@ from homeassistant.const import (
|
||||
UnitOfTime,
|
||||
UnitOfVolumetricFlux,
|
||||
)
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
from homeassistant.setup import async_setup_component
|
||||
from homeassistant.util.dt import utcnow
|
||||
@@ -37,7 +38,7 @@ from . import init_integration
|
||||
from tests.common import async_fire_time_changed, load_fixture
|
||||
|
||||
|
||||
async def test_sensor_without_forecast(hass):
|
||||
async def test_sensor_without_forecast(hass: HomeAssistant) -> None:
|
||||
"""Test states of the sensor without forecast."""
|
||||
await init_integration(hass)
|
||||
registry = er.async_get(hass)
|
||||
@@ -115,7 +116,7 @@ async def test_sensor_without_forecast(hass):
|
||||
assert entry.unique_id == "0123456-uvindex"
|
||||
|
||||
|
||||
async def test_sensor_with_forecast(hass):
|
||||
async def test_sensor_with_forecast(hass: HomeAssistant) -> None:
|
||||
"""Test states of the sensor with forecast."""
|
||||
await init_integration(hass, forecast=True)
|
||||
registry = er.async_get(hass)
|
||||
@@ -193,7 +194,7 @@ async def test_sensor_with_forecast(hass):
|
||||
assert entry.unique_id == "0123456-uvindex-0"
|
||||
|
||||
|
||||
async def test_sensor_disabled(hass):
|
||||
async def test_sensor_disabled(hass: HomeAssistant) -> None:
|
||||
"""Test sensor disabled by default."""
|
||||
await init_integration(hass)
|
||||
registry = er.async_get(hass)
|
||||
@@ -213,7 +214,7 @@ async def test_sensor_disabled(hass):
|
||||
assert updated_entry.disabled is False
|
||||
|
||||
|
||||
async def test_sensor_enabled_without_forecast(hass):
|
||||
async def test_sensor_enabled_without_forecast(hass: HomeAssistant) -> None:
|
||||
"""Test enabling an advanced sensor."""
|
||||
registry = er.async_get(hass)
|
||||
|
||||
@@ -659,7 +660,7 @@ async def test_sensor_enabled_without_forecast(hass):
|
||||
assert entry.unique_id == "0123456-windgustnight-0"
|
||||
|
||||
|
||||
async def test_availability(hass):
|
||||
async def test_availability(hass: HomeAssistant) -> None:
|
||||
"""Ensure that we mark the entities unavailable correctly when service is offline."""
|
||||
await init_integration(hass)
|
||||
|
||||
@@ -700,7 +701,7 @@ async def test_availability(hass):
|
||||
assert state.state == "3200.0"
|
||||
|
||||
|
||||
async def test_manual_update_entity(hass):
|
||||
async def test_manual_update_entity(hass: HomeAssistant) -> None:
|
||||
"""Test manual update entity via service homeassistant/update_entity."""
|
||||
await init_integration(hass, forecast=True)
|
||||
|
||||
@@ -730,7 +731,7 @@ async def test_manual_update_entity(hass):
|
||||
assert mock_forecast.call_count == 1
|
||||
|
||||
|
||||
async def test_sensor_imperial_units(hass):
|
||||
async def test_sensor_imperial_units(hass: HomeAssistant) -> None:
|
||||
"""Test states of the sensor without forecast."""
|
||||
hass.config.units = US_CUSTOMARY_SYSTEM
|
||||
await init_integration(hass)
|
||||
@@ -743,7 +744,7 @@ async def test_sensor_imperial_units(hass):
|
||||
assert state.attributes.get(ATTR_UNIT_OF_MEASUREMENT) == UnitOfLength.FEET
|
||||
|
||||
|
||||
async def test_state_update(hass):
|
||||
async def test_state_update(hass: HomeAssistant) -> None:
|
||||
"""Ensure the sensor state changes after updating the data."""
|
||||
await init_integration(hass)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user