Skip to content

Commit

Permalink
test: trapz should be used for Numpy < 2
Browse files Browse the repository at this point in the history
  • Loading branch information
hgrecco committed Feb 15, 2025
1 parent 9b33203 commit 48106e2
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pint/testsuite/test_numpy_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,15 @@ def test_trapz(self):
np.trapezoid(t, x=z), self.Q_(1108.6, "kelvin meter")
)

@helpers.requires_numpy_at_least("2.0")
@helpers.requires_numpy_previous_than("2.0")
def test_trapz_no_autoconvert(self):
t = self.Q_(np.array([0.0, 4.0, 8.0]), "degC")
z = self.Q_(np.array([0.0, 2.0, 4.0]), "m")
with pytest.raises(OffsetUnitCalculusError):
np.trapz(t, x=z)

@helpers.requires_numpy_at_least("2.0")
def test_trapezoid_no_autoconvert(self):
t = self.Q_(np.array([0.0, 4.0, 8.0]), "degC")
z = self.Q_(np.array([0.0, 2.0, 4.0]), "m")
with pytest.raises(OffsetUnitCalculusError):
Expand Down

0 comments on commit 48106e2

Please sign in to comment.