Skip to content

Commit 48106e2

Browse files
committed
test: trapz should be used for Numpy < 2
1 parent 9b33203 commit 48106e2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pint/testsuite/test_numpy_func.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,15 @@ def test_trapz(self):
210210
np.trapezoid(t, x=z), self.Q_(1108.6, "kelvin meter")
211211
)
212212

213-
@helpers.requires_numpy_at_least("2.0")
213+
@helpers.requires_numpy_previous_than("2.0")
214214
def test_trapz_no_autoconvert(self):
215+
t = self.Q_(np.array([0.0, 4.0, 8.0]), "degC")
216+
z = self.Q_(np.array([0.0, 2.0, 4.0]), "m")
217+
with pytest.raises(OffsetUnitCalculusError):
218+
np.trapz(t, x=z)
219+
220+
@helpers.requires_numpy_at_least("2.0")
221+
def test_trapezoid_no_autoconvert(self):
215222
t = self.Q_(np.array([0.0, 4.0, 8.0]), "degC")
216223
z = self.Q_(np.array([0.0, 2.0, 4.0]), "m")
217224
with pytest.raises(OffsetUnitCalculusError):

0 commit comments

Comments
 (0)