def test_real_set_lazy(self):
     # Setting new lazy data does not make a copy.
     ancill_var = AncillaryVariable(self.data_real)
     new_data = self.data_lazy + 102.3
     ancill_var.data = new_data
     result = ancill_var.core_data()
     self.assertEqualLazyArraysAndDtypes(result, new_data)
 def test_real_set_real(self):
     # Setting new real data does not make a copy.
     ancill_var = AncillaryVariable(self.data_real)
     new_data = self.data_real + 102.3
     ancill_var.data = new_data
     result = ancill_var.core_data()
     self.assertArraysShareData(
         result, new_data,
         'Data values do not share data with the assigned array.')
 def test_fail_bad_shape(self):
     # Setting real data requires matching shape.
     ancill_var = AncillaryVariable([1.0, 2.0])
     msg = r"Require data with shape \(2,\), got \(3,\)"
     with self.assertRaisesRegex(ValueError, msg):
         ancill_var.data = np.array([1.0, 2.0, 3.0])