From a77405074ed045d9633a1414316c5cf4471977a3 Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Sun, 10 Mar 2019 13:26:33 -0400 Subject: [PATCH 1/3] TST: failing wheel building on PY2 and old numpy (#25631) closes #25630 --- pandas/tests/frame/test_constructors.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/tests/frame/test_constructors.py b/pandas/tests/frame/test_constructors.py index b97f5e0b6edf9..e1394af0cc022 100644 --- a/pandas/tests/frame/test_constructors.py +++ b/pandas/tests/frame/test_constructors.py @@ -20,7 +20,7 @@ import pandas as pd from pandas import ( Categorical, DataFrame, Index, MultiIndex, Series, Timedelta, Timestamp, - compat, date_range, isna) + _np_version_under1p13, compat, date_range, isna) from pandas.tests.frame.common import TestData import pandas.util.testing as tm @@ -682,6 +682,8 @@ def test_constructor_ndarray(self): frame = DataFrame(['foo', 'bar'], index=[0, 1], columns=['A']) assert len(frame) == 2 + @pytest.mark.skipif(PY2 & _np_version_under1p13, + reason="old numpy & py2") def test_constructor_maskedarray(self): self._check_basic_constructor(ma.masked_all) From 74be055fd2768d4f28ab6d2cad32e997a09d3d52 Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Sun, 10 Mar 2019 18:57:26 -0400 Subject: [PATCH 2/3] TST: xref #25630 (#25643) * TST: xref #25630 --- pandas/tests/frame/test_constructors.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pandas/tests/frame/test_constructors.py b/pandas/tests/frame/test_constructors.py index e1394af0cc022..0821a66427964 100644 --- a/pandas/tests/frame/test_constructors.py +++ b/pandas/tests/frame/test_constructors.py @@ -682,7 +682,7 @@ def test_constructor_ndarray(self): frame = DataFrame(['foo', 'bar'], index=[0, 1], columns=['A']) assert len(frame) == 2 - @pytest.mark.skipif(PY2 & _np_version_under1p13, + @pytest.mark.skipif(PY2 and _np_version_under1p13, reason="old numpy & py2") def test_constructor_maskedarray(self): self._check_basic_constructor(ma.masked_all) @@ -700,6 +700,8 @@ def test_constructor_maskedarray(self): frame = DataFrame(mat, columns=['A', 'B', 'C'], index=[1, 2]) assert np.all(~np.asarray(frame == frame)) + @pytest.mark.skipif(PY2 and _np_version_under1p13, + reason="old numpy & py2") def test_constructor_maskedarray_nonfloat(self): # masked int promoted to float mat = ma.masked_all((2, 3), dtype=int) @@ -767,6 +769,8 @@ def test_constructor_maskedarray_nonfloat(self): assert frame['A'][1] is True assert frame['C'][2] is False + @pytest.mark.skipif(PY2 and _np_version_under1p13, + reason="old numpy & py2") def test_constructor_maskedarray_hardened(self): # Check numpy masked arrays with hard masks -- from GH24574 mat_hard = ma.masked_all((2, 2), dtype=float).harden_mask() @@ -789,6 +793,8 @@ def test_constructor_maskedarray_hardened(self): dtype=float) tm.assert_frame_equal(result, expected) + @pytest.mark.skipif(PY2 and _np_version_under1p13, + reason="old numpy & py2") def test_constructor_maskedrecarray_dtype(self): # Ensure constructor honors dtype data = np.ma.array( @@ -800,6 +806,8 @@ def test_constructor_maskedrecarray_dtype(self): columns=['date', 'price']) tm.assert_frame_equal(result, expected) + @pytest.mark.skipif(PY2 and _np_version_under1p13, + reason="old numpy & py2") def test_constructor_mrecarray(self): # Ensure mrecarray produces frame identical to dict of masked arrays # from GH3479 From 532ea18bd06f0347abb32d87dbc1fffd21fff7fc Mon Sep 17 00:00:00 2001 From: Jeff Reback Date: Sun, 10 Mar 2019 19:08:03 -0400 Subject: [PATCH 3/3] add PY2 import --- pandas/tests/frame/test_constructors.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/frame/test_constructors.py b/pandas/tests/frame/test_constructors.py index 0821a66427964..40a942c96ea2b 100644 --- a/pandas/tests/frame/test_constructors.py +++ b/pandas/tests/frame/test_constructors.py @@ -11,7 +11,7 @@ import pytest from pandas.compat import ( - PY3, PY36, OrderedDict, is_platform_little_endian, lmap, long, lrange, + PY2, PY3, PY36, OrderedDict, is_platform_little_endian, lmap, long, lrange, lzip, range, zip) from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike