File: test_exceptions.py

package info (click to toggle)
python-aionut 4.3.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 296 kB
  • sloc: python: 508; makefile: 15; javascript: 8
file content (20 lines) | stat: -rw-r--r-- 498 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import logging

from aionut.exceptions import (
    NUTError,
    NUTOSError,
    NUTTimeoutError,
    NUTValueError,
    map_exception,
)

_LOGGER = logging.getLogger("aionut")
_LOGGER.setLevel(logging.DEBUG)
logging.basicConfig(level=logging.DEBUG)


def test_map_exception():
    assert map_exception(TimeoutError()) == NUTTimeoutError
    assert map_exception(ValueError()) == NUTValueError
    assert map_exception(OSError()) == NUTOSError
    assert map_exception(RuntimeError()) == NUTError