def testGetByteSize(self, array, slice_offset, slice_length, expected_size, expected_sliced_size): # make sure the empty array case does not crash. array_util.GetByteSize(pa.array([], array.type)) self.assertEqual(array_util.GetByteSize(array), expected_size) sliced = array.slice(slice_offset, slice_length) self.assertEqual(array_util.GetByteSize(sliced), expected_sliced_size)
def testUnsupported(self): with self.assertRaisesRegex(RuntimeError, "Unimplemented"): array_util.GetByteSize(pa.array([], type=pa.timestamp("s")))