From c8797298ea6975bf6f05bf732e09ebc737a79b8c Mon Sep 17 00:00:00 2001
From: epenet <6771947+epenet@users.noreply.github.com>
Date: Sun, 18 Aug 2024 15:34:59 +0200
Subject: [PATCH] Add missing hass type hint in component tests (e) (#124075)

---
 tests/components/eafm/test_sensor.py   | 7 ++++++-
 tests/components/energy/test_sensor.py | 7 +++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/tests/components/eafm/test_sensor.py b/tests/components/eafm/test_sensor.py
index 986e1153cac..add604167b9 100644
--- a/tests/components/eafm/test_sensor.py
+++ b/tests/components/eafm/test_sensor.py
@@ -1,6 +1,9 @@
 """Tests for polling measures."""
 
+from collections.abc import Callable, Coroutine
 import datetime
+from typing import Any
+from unittest.mock import AsyncMock
 
 import aiohttp
 import pytest
@@ -23,7 +26,9 @@ CONNECTION_EXCEPTIONS = [
 ]
 
 
-async def async_setup_test_fixture(hass, mock_get_station, initial_value):
+async def async_setup_test_fixture(
+    hass: HomeAssistant, mock_get_station: AsyncMock, initial_value: dict[str, Any]
+) -> tuple[MockConfigEntry, Callable[[Any], Coroutine[Any, Any, None]]]:
     """Create a dummy config entry for testing polling."""
     mock_get_station.return_value = initial_value
 
diff --git a/tests/components/energy/test_sensor.py b/tests/components/energy/test_sensor.py
index 0439ac2c028..a27451b853d 100644
--- a/tests/components/energy/test_sensor.py
+++ b/tests/components/energy/test_sensor.py
@@ -1,5 +1,6 @@
 """Test the Energy sensors."""
 
+from collections.abc import Callable, Coroutine
 import copy
 from datetime import timedelta
 from typing import Any
@@ -37,10 +38,12 @@ TEST_TIME_ADVANCE_INTERVAL = timedelta(milliseconds=10)
 
 
 @pytest.fixture
-async def setup_integration(recorder_mock: Recorder):
+async def setup_integration(
+    recorder_mock: Recorder,
+) -> Callable[[HomeAssistant], Coroutine[Any, Any, None]]:
     """Set up the integration."""
 
-    async def setup_integration(hass):
+    async def setup_integration(hass: HomeAssistant) -> None:
         assert await async_setup_component(hass, "energy", {})
         await hass.async_block_till_done()
 
-- 
GitLab