Skip to content

Commit 59c4169

Browse files
committed
refactor: inherit FakeChannel from Channel Protocol
1 parent b665b84 commit 59c4169

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

roborock/testing/channel.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66
"""
77

88
from collections.abc import Callable
9+
from typing import Any
910
from unittest.mock import AsyncMock, MagicMock
1011

12+
from roborock.devices.transport.channel import Channel
1113
from roborock.mqtt.health_manager import HealthManager
1214
from roborock.protocols.v1_protocol import LocalProtocolVersion
1315
from roborock.roborock_message import RoborockMessage
1416

1517

16-
class FakeChannel:
17-
"""A stateful, in-memory transport simulator.
18+
class FakeChannel(Channel):
19+
"""A stateful, in-memory transport simulator implementing the Channel protocol.
1820
1921
It captures all published messages in `published_messages`, maintains a registry
2022
of active callbacks in `subscribers`, and enables tests or stateful simulators to
@@ -37,6 +39,8 @@ class FakeChannel:
3739
to simulate the device broadcasting a state change.
3840
"""
3941

42+
subscribe: Any
43+
4044
def __init__(self, is_local: bool = False):
4145
"""Initialize the fake channel."""
4246
self.subscribers: list[Callable[[RoborockMessage], None]] = []

0 commit comments

Comments
 (0)