def test_get_raw(self): f = Field("foo[4] = 0xABCDEF") raw = f.get_raw() target = "\x00\xAB\xCD\xEF" self.assertEqual(target, raw) f = Field("foo[1] = 0xABCDEF") raw = f.get_raw() target = "\xEF" self.assertEqual(target, raw)
def test_long_fields(self): f = Field("foo[16] = 0x11111111 22222222") raw = f.get_raw() target = "\x11"*4 + "\x22"*4 + "\00"*8 self.assertEqual(target, raw)