Esempio n. 1
0
def test_voltage_negative_val():
    with pytest.raises(Exception):
        lpp_voltage_to_bytes((-1, ))
    with pytest.raises(Exception):
        # -25.0V
        lpp_voltage_from_bytes(bytearray([0xf6, 0x3c]))
Esempio n. 2
0
def test_voltage():
    val = (2, )
    vol_buf = lpp_voltage_to_bytes(val)
    assert lpp_voltage_from_bytes(vol_buf) == val
Esempio n. 3
0
def test_voltage_invalid_val():
    with pytest.raises(Exception):
        lpp_voltage_to_bytes((0, 1))