From 484637d0480e324b001f90199e872f1b73a7f455 Mon Sep 17 00:00:00 2001 From: OlivierLuG Date: Thu, 28 May 2020 23:37:49 +0200 Subject: [PATCH 1/3] TST #28981 comparison operation for interval dtypes --- pandas/tests/arithmetic/test_period.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pandas/tests/arithmetic/test_period.py b/pandas/tests/arithmetic/test_period.py index d206622521816..9413e10060c04 100644 --- a/pandas/tests/arithmetic/test_period.py +++ b/pandas/tests/arithmetic/test_period.py @@ -1525,8 +1525,11 @@ def test_pi_sub_period_nat(self): @pytest.mark.parametrize("scalars", ["a", False, 1, 1.0, None]) def test_comparison_operations(self, scalars): - # GH 28980 + # GH #28980 and GH #28981 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) + s = pd.Series([pd.Interval(0, 1), pd.Interval(1, 2)], dtype="interval") + result = s == scalars + tm.assert_series_equal(result, expected) From c78270fd1ccec2bbc657fa239a468893dc6ccaba Mon Sep 17 00:00:00 2001 From: OlivierLuG Date: Fri, 29 May 2020 08:25:04 +0200 Subject: [PATCH 2/3] TST #28981 comparison operation for interval dtypes (2) --- pandas/tests/arithmetic/test_interval.py | 8 ++++++++ pandas/tests/arithmetic/test_period.py | 5 +---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pandas/tests/arithmetic/test_interval.py b/pandas/tests/arithmetic/test_interval.py index 66526204a6208..50b5fe8e6f6b9 100644 --- a/pandas/tests/arithmetic/test_interval.py +++ b/pandas/tests/arithmetic/test_interval.py @@ -284,3 +284,11 @@ def test_index_series_compat(self, op, constructor, expected_type, assert_func): result = op(index, other) expected = expected_type(self.elementwise_comparison(op, index, other)) assert_func(result, expected) + + @pytest.mark.parametrize("scalars", ["a", False, 1, 1.0, None]) + def test_comparison_operations(self, scalars): + # GH #28981 + expected = Series([False, False]) + s = pd.Series([pd.Interval(0, 1), pd.Interval(1, 2)], dtype="interval") + result = s == scalars + tm.assert_series_equal(result, expected) diff --git a/pandas/tests/arithmetic/test_period.py b/pandas/tests/arithmetic/test_period.py index 9413e10060c04..7e8783ad4b854 100644 --- a/pandas/tests/arithmetic/test_period.py +++ b/pandas/tests/arithmetic/test_period.py @@ -1525,11 +1525,8 @@ def test_pi_sub_period_nat(self): @pytest.mark.parametrize("scalars", ["a", False, 1, 1.0, None]) def test_comparison_operations(self, scalars): - # GH #28980 and GH #28981 + # 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) - s = pd.Series([pd.Interval(0, 1), pd.Interval(1, 2)], dtype="interval") - result = s == scalars - tm.assert_series_equal(result, expected) From e111631897ab33672b57dc4f2e502c4267729ccb Mon Sep 17 00:00:00 2001 From: OlivierLuG Date: Wed, 3 Jun 2020 08:38:07 +0200 Subject: [PATCH 3/3] TST #28981 comparison operation for interval dtypes (3) --- pandas/tests/arithmetic/test_period.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/arithmetic/test_period.py b/pandas/tests/arithmetic/test_period.py index 7e8783ad4b854..d206622521816 100644 --- a/pandas/tests/arithmetic/test_period.py +++ b/pandas/tests/arithmetic/test_period.py @@ -1525,7 +1525,7 @@ def test_pi_sub_period_nat(self): @pytest.mark.parametrize("scalars", ["a", False, 1, 1.0, None]) def test_comparison_operations(self, scalars): - # GH #28980 + # GH 28980 expected = Series([False, False]) s = Series([pd.Period("2019"), pd.Period("2020")], dtype="period[A-DEC]") result = s == scalars