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
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
from pyipmi.fields import (VersionField, FruTypeLengthString)
from pyipmi.errors import DecodingError
def test_versionfield_object():
version = VersionField([1, 0x99])
assert version.major == 1
assert version.minor == 99
version = VersionField('\x00\x99')
assert version.major == 0
assert version.minor == 99
def test_versionfield_invalid():
version = VersionField('\x00\xff')
assert version.major == 0
assert version.minor == 255
def test_versionfield_decoding_error():
with pytest.raises(DecodingError):
version = VersionField('\x00\x9a') # noqa:F841
def test_FruTypeLengthString_6bitascii():
f = FruTypeLengthString(b'\x83d\xc9\xb2\xde', 0)
assert f.string == 'DELL'
|