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 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"])})] )