Пример #1
0
 def test_inverse_self(self):
     """Test series inversion with self."""
     series = Series(self.x, self.data_cplx)
     inverted = series.inverse()
     # Division should return a new object, so there shouldn't be issues with data changing
     # later.
     series.y = np.zeros_like(series.y)
     self.assertTrue(np.allclose(inverted.x, series.x))
     self.assertTrue(np.allclose(inverted.y, 1 / self.data_cplx))
Пример #2
0
 def test_inverse(self):
     """Test series inversion."""
     series = Series(self.x, self.data_cplx)
     # Standard inverse.
     inverted = series.inverse()
     self.assertTrue(np.allclose(inverted.x, series.x))
     self.assertTrue(np.allclose(inverted.y, 1 / self.data_cplx))
     # Alternate inverse.
     inverted = 1 / series
     self.assertTrue(np.allclose(inverted.x, series.x))
     self.assertTrue(np.allclose(inverted.y, 1 / self.data_cplx))