def to_little_endian_i2be(self): arr = numpy.arange(256, 259, dtype=">i2") data = arr.bytes() data_le = to_little_endian(arr).bytes() self.assertEqual(data_le, b"\x01\x00\x01\x01\x01\x02") self.assertEqual(data, b"\x00\x01\x01\x01\x02\x01") to_little_endian(arr, inplace=True) self.assertEqual(arr.bytes(), data_le)
def to_little_endian_float(self): arr = numpy.arange(256, 259, dtype="f") data = arr.bytes() # no-op data_le = to_little_endian(arr).bytes() self.assertEqual(data_le, data)
def to_little_endian_i2le(self): arr = numpy.arange(256, 259, dtype="<i2") data = arr.bytes() data_le = to_little_endian(arr).bytes() self.assertEqual(data, data_le)