Add type hints to integration tests (part 21) (#88233)

This commit is contained in:
epenet 2023-02-16 11:15:26 +01:00 committed by GitHub
parent 0748e12341
commit dab8557951
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 536 additions and 328 deletions

View file

@ -212,7 +212,7 @@ async def test_state_change_count(hass: HomeAssistant) -> None:
assert len(events) < 721
async def test_setup_and_remove_config_entry(hass: ha.HomeAssistant) -> None:
async def test_setup_and_remove_config_entry(hass: HomeAssistant) -> None:
"""Test setting up and removing a config entry."""
# Setup the config entry
config_entry = MockConfigEntry(domain=sun.DOMAIN)

View file

@ -3,6 +3,7 @@ from __future__ import annotations
from datetime import timedelta
from homeassistant.components.recorder import Recorder
from homeassistant.components.recorder.db_schema import StateAttributes, States
from homeassistant.components.recorder.util import session_scope
from homeassistant.components.sun import (
@ -18,7 +19,7 @@ from homeassistant.components.sun import (
STATE_ATTR_RISING,
)
from homeassistant.const import ATTR_FRIENDLY_NAME
from homeassistant.core import State
from homeassistant.core import HomeAssistant, State
from homeassistant.setup import async_setup_component
from homeassistant.util import dt as dt_util
@ -26,7 +27,7 @@ from tests.common import async_fire_time_changed
from tests.components.recorder.common import async_wait_recording_done
async def test_exclude_attributes(recorder_mock, hass):
async def test_exclude_attributes(recorder_mock: Recorder, hass: HomeAssistant) -> None:
"""Test sun attributes to be excluded."""
await async_setup_component(hass, DOMAIN, {})
await hass.async_block_till_done()

View file

@ -14,6 +14,7 @@ from homeassistant.const import (
SUN_EVENT_SUNRISE,
SUN_EVENT_SUNSET,
)
from homeassistant.core import HomeAssistant
from homeassistant.setup import async_setup_component
import homeassistant.util.dt as dt_util
@ -36,7 +37,7 @@ def setup_comp(hass):
)
async def test_sunset_trigger(hass, calls):
async def test_sunset_trigger(hass: HomeAssistant, calls) -> None:
"""Test the sunset trigger."""
now = datetime(2015, 9, 15, 23, tzinfo=dt_util.UTC)
trigger_time = datetime(2015, 9, 16, 2, tzinfo=dt_util.UTC)
@ -81,7 +82,7 @@ async def test_sunset_trigger(hass, calls):
assert calls[0].data["id"] == 0
async def test_sunrise_trigger(hass, calls):
async def test_sunrise_trigger(hass: HomeAssistant, calls) -> None:
"""Test the sunrise trigger."""
now = datetime(2015, 9, 13, 23, tzinfo=dt_util.UTC)
trigger_time = datetime(2015, 9, 16, 14, tzinfo=dt_util.UTC)
@ -103,7 +104,7 @@ async def test_sunrise_trigger(hass, calls):
assert len(calls) == 1
async def test_sunset_trigger_with_offset(hass, calls):
async def test_sunset_trigger_with_offset(hass: HomeAssistant, calls) -> None:
"""Test the sunset trigger with offset."""
now = datetime(2015, 9, 15, 23, tzinfo=dt_util.UTC)
trigger_time = datetime(2015, 9, 16, 2, 30, tzinfo=dt_util.UTC)
@ -136,7 +137,7 @@ async def test_sunset_trigger_with_offset(hass, calls):
assert calls[0].data["some"] == "sun - sunset - 0:30:00"
async def test_sunrise_trigger_with_offset(hass, calls):
async def test_sunrise_trigger_with_offset(hass: HomeAssistant, calls) -> None:
"""Test the sunrise trigger with offset."""
now = datetime(2015, 9, 13, 23, tzinfo=dt_util.UTC)
trigger_time = datetime(2015, 9, 16, 13, 30, tzinfo=dt_util.UTC)