def test_set_dataio_data_already_set(self): """ Test that Data.set_dataio works as intended """ dataio = DataIO(data=np.arange(30).reshape(5, 2, 3)) data = np.arange(30).reshape(5, 2, 3) container = Data('wrapped_data', data) with self.assertRaisesWith(ValueError, "cannot overwrite 'data' on DataIO"): container.set_dataio(dataio)
def test_set_dataio(self): """ Test that Data.set_dataio works as intended """ dataio = DataIO() data = np.arange(30).reshape(5, 2, 3) container = Data('wrapped_data', data) container.set_dataio(dataio) self.assertIs(dataio.data, data) self.assertIs(dataio, container.data)