From 768d20c6455c2cfebbb1f900a797f1a1ed8995a4 Mon Sep 17 00:00:00 2001 From: Marc Mueller <30130371+cdce8p@users.noreply.github.com> Date: Sat, 20 Jul 2024 11:10:25 +0200 Subject: [PATCH] Fix recorder datetime annotations (#122214) --- .../recorder/test_migration_from_schema_32.py | 12 ++++++------ tests/components/recorder/test_websocket_api.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/components/recorder/test_migration_from_schema_32.py b/tests/components/recorder/test_migration_from_schema_32.py index 8a542ed8764..b2a83ae8313 100644 --- a/tests/components/recorder/test_migration_from_schema_32.py +++ b/tests/components/recorder/test_migration_from_schema_32.py @@ -950,7 +950,7 @@ async def test_stats_timestamp_conversion_is_reentrant( ) ) - def _insert_pre_timestamp_stat(date_time: datetime) -> None: + def _insert_pre_timestamp_stat(date_time: datetime.datetime) -> None: with session_scope(hass=hass) as session: session.add( old_db_schema.StatisticsShortTerm( @@ -965,7 +965,7 @@ async def test_stats_timestamp_conversion_is_reentrant( ) ) - def _insert_post_timestamp_stat(date_time: datetime) -> None: + def _insert_post_timestamp_stat(date_time: datetime.datetime) -> None: with session_scope(hass=hass) as session: session.add( db_schema.StatisticsShortTerm( @@ -1107,7 +1107,7 @@ async def test_stats_timestamp_with_one_by_one( ) ) - def _insert_pre_timestamp_stat(date_time: datetime) -> None: + def _insert_pre_timestamp_stat(date_time: datetime.datetime) -> None: with session_scope(hass=hass) as session: session.add_all( ( @@ -1134,7 +1134,7 @@ async def test_stats_timestamp_with_one_by_one( ) ) - def _insert_post_timestamp_stat(date_time: datetime) -> None: + def _insert_post_timestamp_stat(date_time: datetime.datetime) -> None: with session_scope(hass=hass) as session: session.add_all( ( @@ -1333,7 +1333,7 @@ async def test_stats_timestamp_with_one_by_one_removes_duplicates( ) ) - def _insert_pre_timestamp_stat(date_time: datetime) -> None: + def _insert_pre_timestamp_stat(date_time: datetime.datetime) -> None: with session_scope(hass=hass) as session: session.add_all( ( @@ -1360,7 +1360,7 @@ async def test_stats_timestamp_with_one_by_one_removes_duplicates( ) ) - def _insert_post_timestamp_stat(date_time: datetime) -> None: + def _insert_post_timestamp_stat(date_time: datetime.datetime) -> None: with session_scope(hass=hass) as session: session.add_all( ( diff --git a/tests/components/recorder/test_websocket_api.py b/tests/components/recorder/test_websocket_api.py index 7467ebe5c4c..5f3b1b35c78 100644 --- a/tests/components/recorder/test_websocket_api.py +++ b/tests/components/recorder/test_websocket_api.py @@ -819,7 +819,7 @@ async def test_statistic_during_period_partial_overlap( hass: HomeAssistant, hass_ws_client: WebSocketGenerator, freezer: FrozenDateTimeFactory, - frozen_time: datetime, + frozen_time: datetime.datetime, ) -> None: """Test statistic_during_period.""" client = await hass_ws_client()