forked from luxonis/depthai-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxlink_exceptions_test.py
More file actions
37 lines (29 loc) · 1.37 KB
/
xlink_exceptions_test.py
File metadata and controls
37 lines (29 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -*- coding: utf-8 -*-
import sys
import pytest
import depthai as dai
from depthai_pybind11_tests import xlink_exceptions as m
def test_xlink_error_exception(msg):
with pytest.raises(dai.XLinkError) as excinfo:
m.throw_xlink_error()
assert msg(excinfo.value) == "Yikes!"
def test_xlink_read_error_exception(msg):
with pytest.raises(dai.XLinkReadError) as excinfo:
m.throw_xlink_read_error()
assert msg(excinfo.value) == "Couldn't read data from stream: 'stream_read' (X_LINK_ERROR)"
def test_xlink_write_error_exception(msg):
with pytest.raises(dai.XLinkWriteError) as excinfo:
m.throw_xlink_write_error()
assert msg(excinfo.value) == "Couldn't write data to stream: 'stream_write' (X_LINK_ERROR)"
def test_xlink_error_exception_runtime_error(msg):
with pytest.raises(RuntimeError) as excinfo:
m.throw_xlink_error()
assert msg(excinfo.value) == "Yikes!"
def test_xlink_read_error_exception_xlink_error(msg):
with pytest.raises(dai.XLinkError) as excinfo:
m.throw_xlink_read_error()
assert msg(excinfo.value) == "Couldn't read data from stream: 'stream_read' (X_LINK_ERROR)"
def test_xlink_write_error_exception_xlink_error(msg):
with pytest.raises(dai.XLinkError) as excinfo:
m.throw_xlink_write_error()
assert msg(excinfo.value) == "Couldn't write data to stream: 'stream_write' (X_LINK_ERROR)"