示例#1
0
        class Header(base.GenericStruct):
            """Mock Header class."""

            version = basic_types.UBInt8(1)
            message_type = basic_types.UBInt8(2)
            length = basic_types.UBInt8(8)
            xid = basic_types.UBInt8(4)
 def setUp(self):
     """Basic test setup."""
     self.ubint8 = basic_types.UBInt8()
示例#3
0
 def test_pack_error(self):
     """[Foundation/BasicTypes/UBInt8] - packing exception."""
     u = basic_types.UBInt8(256)
     self.assertRaises(PackException, u.pack)
示例#4
0
        class AttributeA(base.GenericStruct):
            """Example class."""

            a1 = basic_types.UBInt8(1)
            a2 = basic_types.UBInt16(2)
示例#5
0
 def test_unpack(self):
     """[Foundation/BasicTypes/UBInt8] - unpacking."""
     u = basic_types.UBInt8()
     u.unpack(b'\xfe')
     self.assertEqual(u.value, 254)