Backport fix for test_equal_zero_nan_NP rather than skipping it
The backported commit simply removes the failing assertion.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
From b3b18277ecc682bff7ca1fa9e48992f7ec68e47f Mon Sep 17 00:00:00 2001
|
||||
From: Hernan Grecco <hgrecco@gmail.com>
|
||||
Date: Wed, 12 Jul 2023 20:39:13 -0300
|
||||
Subject: [PATCH] Fix test as NumPy 1.25 changes the rules for equality
|
||||
operator
|
||||
|
||||
---
|
||||
pint/testsuite/test_quantity.py | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/pint/testsuite/test_quantity.py b/pint/testsuite/test_quantity.py
|
||||
index 1843b69ca..7efe74f80 100644
|
||||
--- a/pint/testsuite/test_quantity.py
|
||||
+++ b/pint/testsuite/test_quantity.py
|
||||
@@ -1906,7 +1906,10 @@ def test_equal_zero_nan_NP(self):
|
||||
self.Q_([0, 1, 2], "J") == np.array([0, 0, np.nan]),
|
||||
np.asarray([True, False, False]),
|
||||
)
|
||||
- assert not (self.Q_(np.arange(4), "J") == np.zeros(3))
|
||||
+
|
||||
+ # This raise an exception on NumPy 1.25 as dimensions
|
||||
+ # are different
|
||||
+ # assert not (self.Q_(np.arange(4), "J") == np.zeros(3))
|
||||
|
||||
def test_offset_equal_zero(self):
|
||||
ureg = self.ureg
|
||||
+11
-10
@@ -11,6 +11,15 @@ License: BSD-3-Clause
|
||||
URL: https://github.com/hgrecco/pint
|
||||
Source0: %{pypi_source Pint}
|
||||
|
||||
# Fix test as NumPy 1.25 changes the rules for equality operator
|
||||
# https://github.com/hgrecco/pint/commit/b3b18277ecc682bff7ca1fa9e48992f7ec68e47f
|
||||
#
|
||||
# Fixes:
|
||||
#
|
||||
# test_equal_zero_nan_NP fails with numpy 1.25.1
|
||||
# https://github.com/hgrecco/pint/issues/1825
|
||||
Patch: %{url}/commit/b3b18277ecc682bff7ca1fa9e48992f7ec68e47f.patch
|
||||
|
||||
BuildArch: noarch
|
||||
|
||||
%global _description %{expand:
|
||||
@@ -33,7 +42,7 @@ Summary: %{summary}
|
||||
%pyproject_extras_subpkg -n python3-pint numpy
|
||||
|
||||
%prep
|
||||
%autosetup -n Pint-%{version}
|
||||
%autosetup -n Pint-%{version} -p1
|
||||
|
||||
# We are not sure where this was bundled from, but we are pretty sure it was
|
||||
# bundled from somewhere! We are not building HTML documentation, so we do not
|
||||
@@ -75,15 +84,7 @@ find pint -type f -exec \
|
||||
%pyproject_save_files pint
|
||||
|
||||
%check
|
||||
%global numpy_version %(\
|
||||
%{python3} -c 'import numpy; print(numpy.__version__)' || echo 0)
|
||||
# test_equal_zero_nan_NP fails with numpy 1.25.1
|
||||
# https://github.com/hgrecco/pint/issues/1825
|
||||
%if v"%{numpy_version}" >= v"1.25.1"
|
||||
k="${k-}${k+ and }not (TestCompareNeutral and test_equal_zero_nan_NP)"
|
||||
%endif
|
||||
|
||||
%pytest -k "${k-}"
|
||||
%pytest
|
||||
|
||||
%files -n python3-pint -f %{pyproject_files}
|
||||
%{_bindir}/pint-convert
|
||||
|
||||
Reference in New Issue
Block a user