Skip to content

Commit 792bdea

Browse files
Add regression test for SYSTEC ctypes result codes
1 parent 950d55c commit 792bdea

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎test/test_systec_exceptions.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from ctypes import c_ubyte
2+
3+
from can.interfaces.systec.constants import ReturnCode
4+
from can.interfaces.systec.exceptions import UcanError
5+
6+
7+
def test_ucan_error_accepts_ctypes_result_code() -> None:
8+
def ucan_write_can_msg_ex() -> None:
9+
pass
10+
11+
result = c_ubyte(ReturnCode.ERR_ILLPARAM)
12+
13+
error = UcanError(result, ucan_write_can_msg_ex, ("arg",))
14+
15+
assert error.error_code == ReturnCode.ERR_ILLPARAM
16+
assert "wrong parameter handed over to the function" in str(error)

0 commit comments

Comments
 (0)