Fix build error for numpy-1.20

This commit is contained in:
wk333 2023-07-23 15:42:35 +08:00
parent 5059c1b16f
commit 22ed65ad3d
2 changed files with 47 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From 8ccad121bccd576ecd212efb44109d697024fbf9 Mon Sep 17 00:00:00 2001
From: aekoroglu <ali.erdinc.koroglu@intel.com>
Date: Mon, 5 Sep 2022 16:42:51 +0300
Subject: [PATCH] deprecated numpy alias
Refer: https://github.com/hamcrest/PyHamcrest/pull/218
---
tests/hamcrest_unit_test/number/iscloseto_test.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/hamcrest_unit_test/number/iscloseto_test.py b/tests/hamcrest_unit_test/number/iscloseto_test.py
index f83964fd..b82109c5 100644
--- a/tests/hamcrest_unit_test/number/iscloseto_test.py
+++ b/tests/hamcrest_unit_test/number/iscloseto_test.py
@@ -64,7 +64,7 @@ def testMatcherSupportsDecimal(self):
class IsNumericTest(unittest.TestCase):
@unittest.skipUnless(NUMPY_AVAILABLE, "Skipped because it needs NumPy")
def test_numpy_numeric_type_int(self):
- self.assertTrue(isnumeric(np.int(1)), "Platform integer (normally either int32 or int64)")
+ self.assertTrue(isnumeric(np.int_(1)), "Platform integer (normally either int32 or int64)")
@unittest.skipUnless(NUMPY_AVAILABLE, "Skipped because it needs NumPy")
def test_numpy_numeric_type_int8(self):
@@ -102,7 +102,7 @@ def test_numpy_numeric_type_uint64(self):
@unittest.skipUnless(NUMPY_AVAILABLE, "Skipped because it needs NumPy")
def test_numpy_numeric_type_float(self):
- self.assertTrue(isnumeric(np.float(1)), "Shorthand for float64.")
+ self.assertTrue(isnumeric(np.float_(1)), "Shorthand for float64.")
@unittest.skipUnless(NUMPY_AVAILABLE, "Skipped because it needs NumPy")
def test_numpy_numeric_type_float16(self):
@@ -127,7 +127,7 @@ def test_numpy_numeric_type_float64(self):
@unittest.skipUnless(NUMPY_AVAILABLE, "Skipped because it needs NumPy")
def test_numpy_numeric_type_complex(self):
- self.assertTrue(isnumeric(np.complex(1)), "Shorthand for complex128.")
+ self.assertTrue(isnumeric(np.complex_(1)), "Shorthand for complex128.")
@unittest.skipUnless(NUMPY_AVAILABLE, "Skipped because it needs NumPy")
def test_numpy_numeric_type_complex64(self):

View File

@ -1,10 +1,11 @@
Name: python-hamcrest Name: python-hamcrest
Version: 2.0.3 Version: 2.0.3
Release: 1 Release: 2
Summary: Hamcrest matchers for Python Summary: Hamcrest matchers for Python
License: BSD-3-Clause License: BSD-3-Clause
URL: https://github.com/hamcrest/PyHamcrest URL: https://github.com/hamcrest/PyHamcrest
Source0: https://github.com/hamcrest/PyHamcrest/archive/V2.0.3/%{name}-%{version}.tar.gz Source0: https://github.com/hamcrest/PyHamcrest/archive/V2.0.3/%{name}-%{version}.tar.gz
Patch0: numpy-1.20.0-alias-depr.patch
BuildArch: noarch BuildArch: noarch
%description %description
@ -46,6 +47,9 @@ PYTHONPATH=%{buildroot}%{python3_sitelib} py.test-%{python3_version} -v
%{python3_sitelib}/* %{python3_sitelib}/*
%changelog %changelog
* Sun Jul 23 2023 wangkai <13474090681@163.com> - 2.0.3-2
- Fix build error for numpy-1.20
* Wed Jun 29 2022 yaoxin <yaoxin30@h-partners.com> - 2.0.3-1 * Wed Jun 29 2022 yaoxin <yaoxin30@h-partners.com> - 2.0.3-1
- Update to 2.0.3 - Update to 2.0.3