6c9c7fe7f3
CI / integration tests (3.13) (push) Failing after 1s
Commit lint / pull request title (push) Has been skipped
Docs / links (push) Failing after 1s
CI / unit tests (3.13) (push) Failing after 1s
CI / lint (push) Failing after 1s
CI / integration tests (push) Failing after 1s
CI / package build (push) Failing after 1s
Commit lint / commit messages (push) Failing after 1s
CI / unit tests (push) Failing after 1s
39 lines
1.0 KiB
Python
39 lines
1.0 KiB
Python
from __future__ import annotations
|
|
|
|
from everos.infra.ome.events import BaseEvent
|
|
from everos.infra.ome.exceptions import (
|
|
EmitNotDeclaredError,
|
|
OMEError,
|
|
StartupValidationError,
|
|
)
|
|
|
|
|
|
class _UnknownEvent(BaseEvent):
|
|
pass
|
|
|
|
|
|
def test_ome_error_is_base_exception() -> None:
|
|
assert issubclass(OMEError, Exception)
|
|
|
|
|
|
def test_startup_validation_error_inherits_ome_error() -> None:
|
|
assert issubclass(StartupValidationError, OMEError)
|
|
|
|
|
|
def test_emit_not_declared_error_inherits_ome_error() -> None:
|
|
assert issubclass(EmitNotDeclaredError, OMEError)
|
|
|
|
|
|
def test_emit_not_declared_carries_strategy_and_event() -> None:
|
|
ev = _UnknownEvent()
|
|
err = EmitNotDeclaredError(strategy="cluster_memcells", event=ev)
|
|
assert err.strategy == "cluster_memcells"
|
|
assert err.event is ev
|
|
assert "_UnknownEvent" in str(err)
|
|
assert "cluster_memcells" in str(err)
|
|
|
|
|
|
def test_startup_validation_carries_message() -> None:
|
|
err = StartupValidationError("missing trigger.on")
|
|
assert "missing trigger.on" in str(err)
|