def test_datachunk_astype(self): obj = DataChunk(data=np.arange(3), selection=np.s_[0:3]) newtype = np.dtype('int16') obj_astype = obj.astype(newtype) self.assertNotEqual(id(obj), id(obj_astype)) self.assertEqual(obj_astype.dtype, np.dtype(newtype))
def test_astype(self): temp1 = DataChunk(np.arange(10).reshape(5, 2)) temp2 = temp1.astype('float32') self.assertEqual(temp2.dtype, np.dtype('float32'))