Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use pytest skip for numpy2 test trapezoid #1988

Merged
merged 3 commits into from
May 15, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
skip
andrewgsavage committed May 15, 2024
commit 9c4749c8a97831600a941c33575ef70df914f246
11 changes: 2 additions & 9 deletions pint/testsuite/test_numpy.py
Original file line number Diff line number Diff line change
@@ -13,14 +13,6 @@
from pint.testsuite.test_umath import TestUFuncs


def requires_numpy_2(reason=None):
if reason is None:
reason = "requires numpy >= 2"
return pytest.mark.skipif(
np.lib.NumpyVersion(np.__version__) < "2.0.0b1", reason=reason
)


@helpers.requires_numpy
class TestNumpyMethods:
@classmethod
@@ -456,7 +448,8 @@ def test_trapz(self):

@helpers.requires_array_function_protocol()
# NP2: Remove this when we only support np>=2.0
@requires_numpy_2(reason="trapezoid added in numpy2")
# trapezoid added in numpy 2.0
@helpers.requires_numpy_at_least("2.0")
def test_trapezoid(self):
helpers.assert_quantity_equal(
np.trapezoid([1.0, 2.0, 3.0, 4.0] * self.ureg.J, dx=1 * self.ureg.m),