def testPackerPart(self):
        console.terse("{0}\n".format(self.testPackerPart.__doc__))

        part = packeting.PackerPart()
        self.assertEqual(part.fmt, '!')
        self.assertTrue(part.packer)
        self.assertEqual(part.size, 0)
        self.assertEqual(part.size, len(part))
        self.assertEqual(part.size, part.packer.size)
        self.assertEqual(part.packed, bytearray([]))
        show = part.show()
        self.assertEqual(show, '    PackerPart: packed=0x\n')

        packed = part.pack()
        self.assertEqual(packed, part.packed)
        self.assertEqual(part.packed, bytearray([]))
        show = part.show()
        self.assertEqual(show, '    PackerPart: packed=0x\n')

        raw = bytearray()
        offset = part.parse(raw=raw)
        self.assertEqual(offset, part.size)
        self.assertEqual(offset, 0)
        self.assertEqual(part.packed, bytearray([]))
        show = part.show()
        self.assertEqual(show, '    PackerPart: packed=0x\n')

        raw = bytearray([7, 2, 1, 0])
        offset = part.parse(raw=raw)
        self.assertEqual(offset, part.size)
        self.assertEqual(offset, 0)
        self.assertEqual(part.packed, bytearray([]))
        show = part.show()
        self.assertEqual(show, '    PackerPart: packed=0x\n')

        part = packeting.PackerPart(fmt="!BBB")
        self.assertEqual(part.fmt, '!BBB')
        self.assertTrue(part.packer)
        self.assertEqual(part.size, 3)
        self.assertEqual(part.size, len(part))
        self.assertEqual(part.size, part.packer.size)
        self.assertEqual(part.packed, bytearray([0, 0, 0]))
        show = part.show()
        self.assertEqual(show, '    PackerPart: packed=0x000000\n')
Test PackerPart class
dataset/ETHPy150Open ioflo/ioflo/ioflo/aio/proto/test/test_packeting.py/BasicTestCase.testPackerPart