mirror of
https://github.com/home-assistant/core.git
synced 2025-11-09 10:59:40 +00:00
Improve bluesound conftest function (#154828)
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
"""Common fixtures for the Bluesound tests."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import AsyncGenerator, Generator
|
||||
from dataclasses import dataclass
|
||||
import ipaddress
|
||||
from typing import Any
|
||||
from typing import Any, Self
|
||||
from unittest.mock import AsyncMock, patch
|
||||
|
||||
from pyblu import Input, Player, Preset, Status, SyncStatus
|
||||
@@ -27,8 +29,8 @@ class PlayerMockData:
|
||||
status_long_polling_mock: LongPollingMock[Status]
|
||||
sync_status_long_polling_mock: LongPollingMock[SyncStatus]
|
||||
|
||||
@staticmethod
|
||||
async def generate(host: str) -> "PlayerMockData":
|
||||
@classmethod
|
||||
async def generate(cls, host: str) -> Self:
|
||||
"""Generate player mock data."""
|
||||
host_ip = ipaddress.ip_address(host)
|
||||
assert host_ip.version == 4
|
||||
@@ -110,7 +112,7 @@ class PlayerMockData:
|
||||
]
|
||||
)
|
||||
|
||||
return PlayerMockData(
|
||||
return cls(
|
||||
host, player, status_long_polling_mock, sync_status_long_polling_mock
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user