Skip to content

TST closes #28980 Certain comparison operations misbehaving for period dtype #34417

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pandas/tests/arithmetic/test_period.py
Original file line number Diff line number Diff line change
Expand Up @@ -1522,3 +1522,11 @@ def test_pi_sub_period_nat(self):
exp = pd.TimedeltaIndex([np.nan, np.nan, np.nan, np.nan], name="idx")
tm.assert_index_equal(idx - pd.Period("NaT", freq="M"), exp)
tm.assert_index_equal(pd.Period("NaT", freq="M") - idx, exp)

@pytest.mark.parametrize("scalars", ["a", False, 1, 1.0, None])
def test_comparison_operations(self, scalars):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use the box_with_array fixture?

# GH 28980
expected = Series([False, False])
s = Series([pd.Period("2019"), pd.Period("2020")], dtype="period[A-DEC]")
result = s == scalars
tm.assert_series_equal(result, expected)