Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 python-dateutil pytz cython hypothesis==6.52.1 pytest>=6.2.5 pytest-xdist pytest-cov pytest-asyncio>=0.17
python -m pip list
Expand Down
26 changes: 21 additions & 5 deletions pandas/tests/frame/test_unary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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")]}),
],
Expand All @@ -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"])})]
)
Expand Down