1
0
forked from pool/python-pandas

Accepting request 1094617 from home:Guillaume_G:branches:openSUSE:Factory:ARM

- Fix tests on aarch64:
  * pandas-fix-tests.patch

OBS-URL: https://build.opensuse.org/request/show/1094617
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-pandas?expand=0&rev=90
This commit is contained in:
Dirk Mueller 2023-06-22 11:42:54 +00:00 committed by Git OBS Bridge
parent 7d2709819a
commit ddc519d9d8
3 changed files with 36 additions and 0 deletions

28
pandas-fix-tests.patch Normal file
View File

@ -0,0 +1,28 @@
--- pandas-2.0.2/pandas/tests/frame/indexing/test_setitem.py.orig 2023-06-22 09:00:10.272775300 +0200
+++ pandas-2.0.2/pandas/tests/frame/indexing/test_setitem.py 2023-06-22 09:00:48.663682100 +0200
@@ -61,7 +61,8 @@ class TestDataFrameSetItem:
"dtype", ["int32", "int64", "uint32", "uint64", "float32", "float64"]
)
def test_setitem_dtype(self, dtype, float_frame):
- arr = np.random.randn(len(float_frame))
+ # Use randint since casting negative floats to uints is undefined
+ arr = np.random.randint(1, 10, len(float_frame))
float_frame[dtype] = np.array(arr, dtype=dtype)
assert float_frame[dtype].dtype.name == dtype
--- pandas-2.0.2/pandas/tests/series/methods/test_nlargest.py.orig 2023-06-22 09:02:58.788342500 +0200
+++ pandas-2.0.2/pandas/tests/series/methods/test_nlargest.py 2023-06-22 09:03:26.743975800 +0200
@@ -217,7 +217,12 @@ class TestSeriesNLargestNSmallest:
def test_nlargest_nullable(self, any_numeric_ea_dtype):
# GH#42816
dtype = any_numeric_ea_dtype
- arr = np.random.randn(10).astype(dtype.lower(), copy=False)
+ if dtype.startswith("UInt"):
+ # Can't cast from negative float to uint on some platforms
+ arr = np.random.randint(1, 10, 10)
+ else:
+ arr = np.random.randn(10)
+ arr = arr.astype(dtype.lower(), copy=False)
ser = Series(arr.copy(), dtype=dtype)
ser[1] = pd.NA

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Jun 22 09:36:06 UTC 2023 - Guillaume GARDET <guillaume.gardet@opensuse.org>
- Fix tests on aarch64:
* pandas-fix-tests.patch
-------------------------------------------------------------------
Sun Jun 11 19:51:26 UTC 2023 - Johannes Kastl <kastl@b1-systems.de>

View File

@ -60,6 +60,8 @@ URL: https://pandas.pydata.org/
# Use GitHub Archive: Test-data
Source0: https://github.com/pandas-dev/pandas/archive/refs/tags/v%{version}.tar.gz#/pandas-%{version}-gh.tar.gz
# SourceRepository: https://github.com/pandas-dev/pandas
# https://github.com/pandas-dev/pandas/issues/53791#issuecomment-1602320315
Patch1: pandas-fix-tests.patch
BuildRequires: %{python_module Cython >= 0.29.33 with %python-Cython < 3}
BuildRequires: %{python_module devel >= 3.8}
BuildRequires: %{python_module numpy-devel >= 1.20.3}