Skip to content

Commit c78270f

Browse files
author
OlivierLuG
committed
TST pandas-dev#28981 comparison operation for interval dtypes (2)
1 parent 484637d commit c78270f

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

pandas/tests/arithmetic/test_interval.py

+8
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,11 @@ def test_index_series_compat(self, op, constructor, expected_type, assert_func):
284284
result = op(index, other)
285285
expected = expected_type(self.elementwise_comparison(op, index, other))
286286
assert_func(result, expected)
287+
288+
@pytest.mark.parametrize("scalars", ["a", False, 1, 1.0, None])
289+
def test_comparison_operations(self, scalars):
290+
# GH #28981
291+
expected = Series([False, False])
292+
s = pd.Series([pd.Interval(0, 1), pd.Interval(1, 2)], dtype="interval")
293+
result = s == scalars
294+
tm.assert_series_equal(result, expected)

pandas/tests/arithmetic/test_period.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -1525,11 +1525,8 @@ def test_pi_sub_period_nat(self):
15251525

15261526
@pytest.mark.parametrize("scalars", ["a", False, 1, 1.0, None])
15271527
def test_comparison_operations(self, scalars):
1528-
# GH #28980 and GH #28981
1528+
# GH #28980
15291529
expected = Series([False, False])
15301530
s = Series([pd.Period("2019"), pd.Period("2020")], dtype="period[A-DEC]")
15311531
result = s == scalars
15321532
tm.assert_series_equal(result, expected)
1533-
s = pd.Series([pd.Interval(0, 1), pd.Interval(1, 2)], dtype="interval")
1534-
result = s == scalars
1535-
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)