test: added not overridden reciever base test

This commit is contained in:
JobvAlewijk
2025-11-24 20:06:58 +00:00
committed by Twirre
parent 36f5fae45c
commit fbe8f59c38

View File

@@ -0,0 +1,19 @@
import pytest
from robot_interface.endpoints.receiver_base import ReceiverBase
def test_receiver_base_not_implemented(monkeypatch):
"""
Ensure that the base ReceiverBase raises NotImplementedError when
handle_message is called on a subclass that does not implement it.
"""
# Patch the __abstractmethods__ to allow instantiation
monkeypatch.setattr(ReceiverBase, "__abstractmethods__", frozenset())
class DummyReceiver(ReceiverBase):
pass
dummy = DummyReceiver("dummy") # Can now instantiate
with pytest.raises(NotImplementedError):
dummy.handle_message({"endpoint": "dummy", "data": None})