From fbe8f59c38d06894a70c55966d1a10a8d9ddb059 Mon Sep 17 00:00:00 2001 From: JobvAlewijk Date: Mon, 24 Nov 2025 20:06:58 +0000 Subject: [PATCH] test: added not overridden reciever base test --- test/unit/test_reciever_base.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/unit/test_reciever_base.py diff --git a/test/unit/test_reciever_base.py b/test/unit/test_reciever_base.py new file mode 100644 index 0000000..e4ef78b --- /dev/null +++ b/test/unit/test_reciever_base.py @@ -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})