def test_set_points_with_lazy_bounds(self): # Setting points does not touch lazy bounds. coord = AuxCoord(self.pts_real, bounds=self.bds_lazy) new_pts = self.pts_real + 102.3 coord.points = new_pts result = coord.core_bounds() self.assertEqualLazyArraysAndDtypes(result, self.bds_lazy)
def test_real_set_lazy(self): # Setting new lazy points does not make a copy. coord = AuxCoord(self.pts_real) new_pts = self.pts_lazy + 102.3 coord.points = new_pts result = coord.core_points() self.assertEqualLazyArraysAndDtypes(result, new_pts)
def test_real_set_real(self): # Setting new real points does not make a copy. coord = AuxCoord(self.pts_real) new_pts = self.pts_real + 102.3 coord.points = new_pts result = coord.core_points() self.assertArraysShareData( result, new_pts, 'Points do not share data with the assigned array.')
def test_fail_bad_shape(self): # Setting real points requires matching shape. coord = AuxCoord([1.0, 2.0]) msg = 'Require data with shape \(2,\), got \(3,\)' with self.assertRaisesRegexp(ValueError, msg): coord.points = np.array([1.0, 2.0, 3.0])