diff --git a/tracetools_analysis/test/tracetools_analysis/test_processor.py b/tracetools_analysis/test/tracetools_analysis/test_processor.py index 1b25d62..e0614d9 100644 --- a/tracetools_analysis/test/tracetools_analysis/test_processor.py +++ b/tracetools_analysis/test/tracetools_analysis/test_processor.py @@ -51,6 +51,19 @@ class StubHandler2(EventHandler): self.handler_called = True +class WrongHandler(EventHandler): + + def __init__(self) -> None: + handler_map = { + 'myeventname': self._handler_wrong, + } + super().__init__(handler_map=handler_map) + + def _handler_wrong( + self, + ) -> None: + pass + class TestProcessor(unittest.TestCase): def __init__(self, *args) -> None: @@ -58,6 +71,17 @@ class TestProcessor(unittest.TestCase): *args, ) + def test_handler_wrong_signature(self) -> None: + handler = WrongHandler() + mock_event = { + '_name': 'myeventname', + '_timestamp': 0, + 'cpu_id': 0, + } + processor = Processor(handler) + with self.assertRaises(TypeError): + processor.process([mock_event]) + def test_handler_method_with_merge(self) -> None: handler1 = StubHandler1() handler2 = StubHandler2()