castlecraft_engineer.testing.event_handler
¶
castlecraft_engineer.testing.event_handler
¶
BaseEventHandlerTest
¶
Bases: Generic[TEvent, TEventHandler]
, ABC
Base class for testing EventHandler implementations.
Provides common fixtures and helper methods for event handler tests.
Subclasses must define the handler_class
attribute.
Source code in src/castlecraft_engineer/testing/event_handler.py
handler_class
abstractmethod
property
¶
The specific EventHandler class being tested.
execute_handle(handler, event)
async
¶
Helper method to execute the handler's handle method asynchronously.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
handler
|
TEventHandler
|
The event handler instance. |
required |
event
|
TEvent
|
The event instance to handle. |
required |
Source code in src/castlecraft_engineer/testing/event_handler.py
handler_instance()
¶
Provides an instance of the handler_class. Override this fixture if your handler requires specific dependencies during initialization.