Files
pepperplus-ri/test/unit/test_reciever_base.py
2026-01-29 15:57:22 +01:00

27 lines
901 B
Python

# -*- coding: utf-8 -*-
"""
This program has been developed by students from the bachelor Computer Science at Utrecht
University within the Software Project course.
© Copyright Utrecht University (Department of Information and Computing Sciences)
"""
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})