mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 08:47:10 +00:00
Improve type hints in sonos tests (#123891)
This commit is contained in:
parent
165ec62405
commit
24a8060f43
@ -1,9 +1,10 @@
|
|||||||
"""Configuration for Sonos tests."""
|
"""Configuration for Sonos tests."""
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
from collections.abc import Callable, Generator
|
from collections.abc import Callable, Coroutine, Generator
|
||||||
from copy import copy
|
from copy import copy
|
||||||
from ipaddress import ip_address
|
from ipaddress import ip_address
|
||||||
|
from typing import Any
|
||||||
from unittest.mock import AsyncMock, MagicMock, Mock, patch
|
from unittest.mock import AsyncMock, MagicMock, Mock, patch
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
@ -120,7 +121,9 @@ async def async_autosetup_sonos(async_setup_sonos):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def async_setup_sonos(hass, config_entry, fire_zgs_event):
|
def async_setup_sonos(
|
||||||
|
hass: HomeAssistant, config_entry: MockConfigEntry, fire_zgs_event
|
||||||
|
) -> Callable[[], Coroutine[Any, Any, None]]:
|
||||||
"""Return a coroutine to set up a Sonos integration instance on demand."""
|
"""Return a coroutine to set up a Sonos integration instance on demand."""
|
||||||
|
|
||||||
async def _wrapper():
|
async def _wrapper():
|
||||||
@ -136,7 +139,7 @@ def async_setup_sonos(hass, config_entry, fire_zgs_event):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="config_entry")
|
@pytest.fixture(name="config_entry")
|
||||||
def config_entry_fixture():
|
def config_entry_fixture() -> MockConfigEntry:
|
||||||
"""Create a mock Sonos config entry."""
|
"""Create a mock Sonos config entry."""
|
||||||
return MockConfigEntry(domain=DOMAIN, title="Sonos")
|
return MockConfigEntry(domain=DOMAIN, title="Sonos")
|
||||||
|
|
||||||
@ -650,7 +653,9 @@ def zgs_discovery_fixture():
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(name="fire_zgs_event")
|
@pytest.fixture(name="fire_zgs_event")
|
||||||
def zgs_event_fixture(hass: HomeAssistant, soco: SoCo, zgs_discovery: str):
|
def zgs_event_fixture(
|
||||||
|
hass: HomeAssistant, soco: SoCo, zgs_discovery: str
|
||||||
|
) -> Callable[[], Coroutine[Any, Any, None]]:
|
||||||
"""Create alarm_event fixture."""
|
"""Create alarm_event fixture."""
|
||||||
variables = {"ZoneGroupState": zgs_discovery}
|
variables = {"ZoneGroupState": zgs_discovery}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user