def test_square(self): """Square basics must work.""" dat = square(self.dat) # works elementwise (does not alter the shape) self.assertEqual(self.dat.data.shape, dat.data.shape) # actual square was computed np.testing.assert_array_almost_equal(dat.data, np.square(self.dat.data))
def test_square_copy(self): """Square must not change the original parameter.""" cpy = self.dat.copy() square(self.dat) self.assertEqual(cpy, self.dat)