Skip to content

Commit b69a5ce

Browse files
Backport PR #50698 on branch 1.5.x (CI capture error in numpy dev, fix python-dev build) (#50705)
Backport PR #50698: CI capture error in numpy dev, fix python-dev build Co-authored-by: Marco Edward Gorelli <[email protected]>
1 parent d4062f8 commit b69a5ce

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

.github/workflows/python-dev.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
run: |
7474
python --version
7575
python -m pip install --upgrade pip setuptools wheel
76-
python -m pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy
76+
python -m pip install --extra-index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy
7777
python -m pip install git+https://github.com/nedbat/coveragepy.git
7878
python -m pip install python-dateutil pytz cython hypothesis==6.52.1 pytest>=6.2.5 pytest-xdist pytest-cov pytest-asyncio>=0.17
7979
python -m pip list

pandas/tests/frame/test_unary.py

+21-5
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import numpy as np
44
import pytest
55

6+
from pandas.compat import is_numpy_dev
7+
68
import pandas as pd
79
import pandas._testing as tm
810

@@ -98,11 +100,6 @@ def test_pos_numeric(self, df):
98100
@pytest.mark.parametrize(
99101
"df",
100102
[
101-
# numpy changing behavior in the future
102-
pytest.param(
103-
pd.DataFrame({"a": ["a", "b"]}),
104-
marks=[pytest.mark.filterwarnings("ignore")],
105-
),
106103
pd.DataFrame({"a": np.array([-1, 2], dtype=object)}),
107104
pd.DataFrame({"a": [Decimal("-1.0"), Decimal("2.0")]}),
108105
],
@@ -112,6 +109,25 @@ def test_pos_object(self, df):
112109
tm.assert_frame_equal(+df, df)
113110
tm.assert_series_equal(+df["a"], df["a"])
114111

112+
@pytest.mark.parametrize(
113+
"df",
114+
[
115+
pytest.param(
116+
pd.DataFrame({"a": ["a", "b"]}),
117+
marks=[pytest.mark.filterwarnings("ignore")],
118+
),
119+
],
120+
)
121+
def test_pos_object_raises(self, df):
122+
# GH#21380
123+
if is_numpy_dev:
124+
with pytest.raises(
125+
TypeError, match=r"^bad operand type for unary \+: \'str\'$"
126+
):
127+
tm.assert_frame_equal(+df, df)
128+
else:
129+
tm.assert_series_equal(+df["a"], df["a"])
130+
115131
@pytest.mark.parametrize(
116132
"df", [pd.DataFrame({"a": pd.to_datetime(["2017-01-22", "1970-01-01"])})]
117133
)

0 commit comments

Comments
 (0)