From 77d27af7dde4f6821dffac8c5aeef820285af2f4 Mon Sep 17 00:00:00 2001 From: MarcoGorelli <> Date: Thu, 12 Jan 2023 11:03:51 +0000 Subject: [PATCH 1/3] capture error in numpy dev --- pandas/tests/frame/test_unary.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/pandas/tests/frame/test_unary.py b/pandas/tests/frame/test_unary.py index a69ca0fef7f8b..9caadd0998a26 100644 --- a/pandas/tests/frame/test_unary.py +++ b/pandas/tests/frame/test_unary.py @@ -3,6 +3,8 @@ import numpy as np import pytest +from pandas.compat import is_numpy_dev + import pandas as pd import pandas._testing as tm @@ -98,11 +100,6 @@ def test_pos_numeric(self, df): @pytest.mark.parametrize( "df", [ - # numpy changing behavior in the future - pytest.param( - pd.DataFrame({"a": ["a", "b"]}), - marks=[pytest.mark.filterwarnings("ignore")], - ), pd.DataFrame({"a": np.array([-1, 2], dtype=object)}), pd.DataFrame({"a": [Decimal("-1.0"), Decimal("2.0")]}), ], @@ -112,6 +109,25 @@ def test_pos_object(self, df): tm.assert_frame_equal(+df, df) tm.assert_series_equal(+df["a"], df["a"]) + @pytest.mark.parametrize( + "df", + [ + pytest.param( + pd.DataFrame({"a": ["a", "b"]}), + marks=[pytest.mark.filterwarnings("ignore")], + ), + ], + ) + def test_pos_object_raises(self, df): + # GH#21380 + if is_numpy_dev: + with pytest.raises( + TypeError, match=r"^bad operand type for unary \+: \'str\'$" + ): + tm.assert_frame_equal(+df, df) + else: + tm.assert_series_equal(+df["a"], df["a"]) + @pytest.mark.parametrize( "df", [pd.DataFrame({"a": pd.to_datetime(["2017-01-22", "1970-01-01"])})] ) From ee605db5913f5e79dfb360684bde9ea527df03a4 Mon Sep 17 00:00:00 2001 From: MarcoGorelli <> Date: Thu, 12 Jan 2023 11:10:14 +0000 Subject: [PATCH 2/3] retry From a9dc2d104d006d04a715a03bd4573bc65abff69b Mon Sep 17 00:00:00 2001 From: MarcoGorelli <> Date: Thu, 12 Jan 2023 12:47:49 +0000 Subject: [PATCH 3/3] use --extra-index-url --- .github/workflows/python-dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/python-dev.yml b/.github/workflows/python-dev.yml index 220c1e464742e..9076b66683a29 100644 --- a/.github/workflows/python-dev.yml +++ b/.github/workflows/python-dev.yml @@ -73,7 +73,7 @@ jobs: run: | python --version python -m pip install --upgrade pip setuptools wheel - python -m pip install -i https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy + python -m pip install --extra-index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple numpy python -m pip install git+https://github.com/nedbat/coveragepy.git python -m pip install versioneer[toml] python -m pip install python-dateutil pytz cython hypothesis==6.52.1 pytest>=6.2.5 pytest-xdist pytest-cov pytest-asyncio>=0.17