Esempio n. 1
0
 def test_cumprod_numpy_func(self):
     with pytest.raises(DimensionalityError):
         np.cumprod(self.q)
     with pytest.raises(DimensionalityError):
         np.cumproduct(self.q)
     helpers.assert_quantity_equal(np.cumprod(self.q / self.ureg.m), [1, 2, 6, 24])
     helpers.assert_quantity_equal(
         np.cumproduct(self.q / self.ureg.m), [1, 2, 6, 24]
     )
     helpers.assert_quantity_equal(
         np.cumprod(self.q / self.ureg.m, axis=1), [[1, 2], [3, 12]]
     )
Esempio n. 2
0
 def test_cumprod_numpy_func(self):
     self.assertRaises(DimensionalityError, np.cumprod, self.q)
     self.assertRaises(DimensionalityError, np.cumproduct, self.q)
     self.assertQuantityEqual(np.cumprod(self.q / self.ureg.m),
                              [1, 2, 6, 24])
     self.assertQuantityEqual(np.cumproduct(self.q / self.ureg.m),
                              [1, 2, 6, 24])