示例#1
0
 def test_array_set_data(self):
     b = ByteArray()
     for bytes, fmt in [(1, "B"), (2, "H"), (4, "L"), (8, "Q")]:
         b.set_data(0, 10, bytes, '<')
         self.assertEqual(len(b), bytes)
         self.assertEqual(struct.unpack("<" + fmt, b)[0], 10)
示例#2
0
 def test_array_set_data(self):
     b = ByteArray()
     for bytes, fmt in [(1, "B"), (2, "H"), (4, "L"), (8, "Q")]:
         b.set_data(0, 10, bytes, '<')
         self.assertEqual(len(b), bytes)
         self.assertEqual(struct.unpack("<" + fmt, b)[0], 10)