26 lines
575 B
Python
26 lines
575 B
Python
from __future__ import annotations
|
|||
|
|
|
||
|
|
from sshctl.core.exceptions import (
|
||
|
|
ConfigError,
|
||
|
|
ParseError,
|
||
|
|
ResolverError,
|
||
|
|
SshctlError,
|
||
|
|
)
|
||
|
|
|
||
|
|
|
||
|
|
def test_exception_hierarchy() -> None:
|
||
|
|
assert issubclass(ConfigError, SshctlError)
|
||
|
|
assert issubclass(ParseError, SshctlError)
|
||
|
|
assert issubclass(ResolverError, SshctlError)
|
||
|
|
|
||
|
|
|
||
|
|
def test_sshctl_error_is_base() -> None:
|
||
|
|
assert issubclass(SshctlError, Exception)
|
||
|
|
|
||
|
|
|
||
|
|
def test_exception_raised() -> None:
|
||
|
|
try:
|
||
|
|
raise ConfigError("test error")
|
||
|
|
except SshctlError as e:
|
||
|
|
assert str(e) == "test error"
|