Improve type hints in tod tests (#123917)

This commit is contained in:
epenet 2024-08-14 15:03:38 +02:00 committed by GitHub
parent 7f6bf95aa6
commit 1e5762fbf7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,6 @@
"""Test Times of the Day Binary Sensor."""
from datetime import datetime, timedelta
from datetime import datetime, timedelta, tzinfo
from freezegun.api import FrozenDateTimeFactory
import pytest
@ -16,13 +16,13 @@ from tests.common import assert_setup_component, async_fire_time_changed
@pytest.fixture
def hass_time_zone():
def hass_time_zone() -> str:
"""Return default hass timezone."""
return "US/Pacific"
@pytest.fixture(autouse=True)
async def setup_fixture(hass, hass_time_zone):
async def setup_fixture(hass: HomeAssistant, hass_time_zone: str) -> None:
"""Set up things to be run when tests are started."""
hass.config.latitude = 50.27583
hass.config.longitude = 18.98583
@ -30,7 +30,7 @@ async def setup_fixture(hass, hass_time_zone):
@pytest.fixture
def hass_tz_info(hass):
def hass_tz_info(hass: HomeAssistant) -> tzinfo | None:
"""Return timezone info for the hass timezone."""
return dt_util.get_time_zone(hass.config.time_zone)