def test_all_actions_are_matched():
    """Test that all execution complete events are matched."""
    an_action = LogInfo(msg='some message')
    other_action = LogInfo(msg='other message')
    event_handler = OnExecutionComplete(on_completion=lambda *args: None)
    assert event_handler.matches(ExecutionComplete(action=an_action))
    assert event_handler.matches(ExecutionComplete(action=other_action))
def test_single_action_is_matched():
    """Test that only the target action execution complete event is matched."""
    an_action = LogInfo(msg='some message')
    event_handler = OnExecutionComplete(target_action=an_action,
                                        on_completion=lambda *args: None)
    other_action = LogInfo(msg='other message')
    assert event_handler.matches(ExecutionComplete(action=an_action))
    assert not event_handler.matches(ExecutionComplete(action=other_action))