From f2e4081aee38f850938048beac7fb69c4908bc5e Mon Sep 17 00:00:00 2001 From: Justus Magin Date: Fri, 15 Mar 2024 21:34:44 +0100 Subject: [PATCH] fix: remove all mentions of `cumproduct` (#1954) numpy=2.0 will bring a lot of breaking changes, including the removal of cumproduct. numpy.cumproduct is already deprecated in favor of numpy.cumprod in 1.25; and cumprod is available in 1.23+ --- pint/facets/numpy/numpy_func.py | 2 +- pint/testsuite/test_numpy.py | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/pint/facets/numpy/numpy_func.py b/pint/facets/numpy/numpy_func.py index 57dc5123d..29724837f 100644 --- a/pint/facets/numpy/numpy_func.py +++ b/pint/facets/numpy/numpy_func.py @@ -965,7 +965,7 @@ def implementation(a, *args, **kwargs): return a._REGISTRY.Quantity(func(a_stripped, *args, **kwargs)) -for func_str in ("cumprod", "cumproduct", "nancumprod"): +for func_str in ("cumprod", "nancumprod"): implement_single_dimensionless_argument_func(func_str) # Handle single-argument consistent unit functions diff --git a/pint/testsuite/test_numpy.py b/pint/testsuite/test_numpy.py index b0adf24a2..69c8128c0 100644 --- a/pint/testsuite/test_numpy.py +++ b/pint/testsuite/test_numpy.py @@ -380,12 +380,7 @@ def test_cumprod(self): 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]] )