- support newest numpy by removing old test gh#pandas-dev/pandas#34991 pandas-pr34991-npconstructor.patch - move testing to multibuild flavor - run slow tests only on x86_64 - replace gcc10-skip-one-test.patch with pytest -k deselection - tidy SKIP_TESTS declarations - add pandas-pytest.ini as pytest.ini in order to support the custom marks and filter some warnings - remove random hash seed OBS-URL: https://build.opensuse.org/request/show/822301 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-pandas?expand=0&rev=46
79 lines
3.0 KiB
Diff
79 lines
3.0 KiB
Diff
Index: pandas-1.0.5/pandas/core/internals/construction.py
|
|
===================================================================
|
|
--- pandas-1.0.5.orig/pandas/core/internals/construction.py
|
|
+++ pandas-1.0.5/pandas/core/internals/construction.py
|
|
@@ -292,7 +292,7 @@ def prep_ndarray(values, copy=True) -> n
|
|
if values.ndim == 1:
|
|
values = values.reshape((values.shape[0], 1))
|
|
elif values.ndim != 2:
|
|
- raise ValueError("Must pass 2-d input")
|
|
+ raise ValueError(f"Must pass 2-d input. shape={values.shape}")
|
|
|
|
return values
|
|
|
|
Index: pandas-1.0.5/pandas/tests/frame/test_constructors.py
|
|
===================================================================
|
|
--- pandas-1.0.5.orig/pandas/tests/frame/test_constructors.py
|
|
+++ pandas-1.0.5/pandas/tests/frame/test_constructors.py
|
|
@@ -9,7 +9,7 @@ import numpy.ma.mrecords as mrecords
|
|
import pytest
|
|
|
|
from pandas.compat import is_platform_little_endian
|
|
-from pandas.compat.numpy import _is_numpy_dev
|
|
+from pandas.compat.numpy import _np_version_under1p19
|
|
|
|
from pandas.core.dtypes.common import is_integer_dtype
|
|
|
|
@@ -145,14 +145,20 @@ class TestDataFrameConstructors:
|
|
assert df.loc[1, 0] is None
|
|
assert df.loc[0, 1] == "2"
|
|
|
|
- @pytest.mark.xfail(_is_numpy_dev, reason="Interprets list of frame as 3D")
|
|
- def test_constructor_list_frames(self):
|
|
- # see gh-3243
|
|
- result = DataFrame([DataFrame()])
|
|
- assert result.shape == (1, 0)
|
|
-
|
|
- result = DataFrame([DataFrame(dict(A=np.arange(5)))])
|
|
- assert isinstance(result.iloc[0, 0], DataFrame)
|
|
+ @pytest.mark.skipif(_np_version_under1p19, reason="NumPy change.")
|
|
+ def test_constructor_list_of_2d_raises(self):
|
|
+ # https://github.com/pandas-dev/pandas/issues/32289
|
|
+ a = pd.DataFrame()
|
|
+ b = np.empty((0, 0))
|
|
+ with pytest.raises(ValueError, match=r"shape=\(1, 0, 0\)"):
|
|
+ pd.DataFrame([a])
|
|
+
|
|
+ with pytest.raises(ValueError, match=r"shape=\(1, 0, 0\)"):
|
|
+ pd.DataFrame([b])
|
|
+
|
|
+ a = pd.DataFrame({"A": [1, 2]})
|
|
+ with pytest.raises(ValueError, match=r"shape=\(2, 2, 1\)"):
|
|
+ pd.DataFrame([a, a])
|
|
|
|
def test_constructor_mixed_dtypes(self):
|
|
def _make_mixed_dtypes_df(typ, ad=None):
|
|
@@ -498,22 +504,6 @@ class TestDataFrameConstructors:
|
|
with pytest.raises(ValueError, match=msg):
|
|
DataFrame({"a": False, "b": True})
|
|
|
|
- @pytest.mark.xfail(_is_numpy_dev, reason="Interprets embedded frame as 3D")
|
|
- def test_constructor_with_embedded_frames(self):
|
|
-
|
|
- # embedded data frames
|
|
- df1 = DataFrame({"a": [1, 2, 3], "b": [3, 4, 5]})
|
|
- df2 = DataFrame([df1, df1 + 10])
|
|
-
|
|
- df2.dtypes
|
|
- str(df2)
|
|
-
|
|
- result = df2.loc[0, 0]
|
|
- tm.assert_frame_equal(result, df1)
|
|
-
|
|
- result = df2.loc[1, 0]
|
|
- tm.assert_frame_equal(result, df1 + 10)
|
|
-
|
|
def test_constructor_subclass_dict(self, float_frame, dict_subclass):
|
|
# Test for passing dict subclass to constructor
|
|
data = {
|