22 lines
543 B
Python
22 lines
543 B
Python
import pytest
|
|
from ecu_framework.lin.base import LinFrame
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_linframe_accepts_valid_ranges():
|
|
f = LinFrame(id=0x3F, data=bytes([0] * 8))
|
|
assert f.id == 0x3F and len(f.data) == 8
|
|
|
|
|
|
@pytest.mark.unit
|
|
@pytest.mark.parametrize("bad_id", [-1, 0x40])
|
|
def test_linframe_invalid_id_raises(bad_id):
|
|
with pytest.raises(ValueError):
|
|
LinFrame(id=bad_id, data=b"\x00")
|
|
|
|
|
|
@pytest.mark.unit
|
|
def test_linframe_too_long_raises():
|
|
with pytest.raises(ValueError):
|
|
LinFrame(id=0x01, data=bytes(range(9)))
|