mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 04:50:05 +00:00
Add missing hass type in tests/helpers (#124039)
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
"""Test singleton helper."""
|
||||
|
||||
from typing import Any
|
||||
from unittest.mock import Mock
|
||||
|
||||
import pytest
|
||||
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import singleton
|
||||
|
||||
|
||||
@@ -14,11 +16,11 @@ def mock_hass():
|
||||
|
||||
|
||||
@pytest.mark.parametrize("result", [object(), {}, []])
|
||||
async def test_singleton_async(mock_hass, result) -> None:
|
||||
async def test_singleton_async(mock_hass: HomeAssistant, result: Any) -> None:
|
||||
"""Test singleton with async function."""
|
||||
|
||||
@singleton.singleton("test_key")
|
||||
async def something(hass):
|
||||
async def something(hass: HomeAssistant) -> Any:
|
||||
return result
|
||||
|
||||
result1 = await something(mock_hass)
|
||||
@@ -30,11 +32,11 @@ async def test_singleton_async(mock_hass, result) -> None:
|
||||
|
||||
|
||||
@pytest.mark.parametrize("result", [object(), {}, []])
|
||||
def test_singleton(mock_hass, result) -> None:
|
||||
def test_singleton(mock_hass: HomeAssistant, result: Any) -> None:
|
||||
"""Test singleton with function."""
|
||||
|
||||
@singleton.singleton("test_key")
|
||||
def something(hass):
|
||||
def something(hass: HomeAssistant) -> Any:
|
||||
return result
|
||||
|
||||
result1 = something(mock_hass)
|
||||
|
||||
Reference in New Issue
Block a user