1
0
mirror of https://github.com/home-assistant/core.git synced 2026-02-25 20:35:09 +00:00
Files
core/tests/components/systemnexa2/__init__.py
konsulten b73beba152 System Nexa 2 Core Integration (#159140)
Co-authored-by: Joost Lekkerkerker <joostlek@outlook.com>
2026-02-19 13:31:17 +01:00

18 lines
545 B
Python

"""Tests for the System Nexa 2 component."""
from collections.abc import Awaitable, Callable
from unittest.mock import MagicMock
import pytest
from sn2.device import UpdateEvent
def find_update_callback(
mock: MagicMock,
) -> Callable[[UpdateEvent], Awaitable[None]]:
"""Find the update callback that was registered with the device."""
for call in mock.initiate_device.call_args_list:
if call.kwargs.get("on_update"):
return call.kwargs["on_update"]
pytest.fail("Update callback not found in mock calls")