Skip to content

Commit 76b8ecd

Browse files
TST: move comparision tests (#30182)
1 parent f619819 commit 76b8ecd

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

pandas/tests/arrays/test_integer.py

+21
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,27 @@ def test_compare_array(self, data, all_compare_operators):
389389
other = pd.Series([0] * len(data))
390390
self._compare_other(data, op_name, other)
391391

392+
def test_compare_to_string(self, any_nullable_int_dtype):
393+
# GH 28930
394+
s = pd.Series([1, None], dtype=any_nullable_int_dtype)
395+
result = s == "a"
396+
expected = pd.Series([False, False])
397+
398+
self.assert_series_equal(result, expected)
399+
400+
def test_compare_to_int(self, any_nullable_int_dtype, all_compare_operators):
401+
# GH 28930
402+
s1 = pd.Series([1, 2, 3], dtype=any_nullable_int_dtype)
403+
s2 = pd.Series([1, 2, 3], dtype="int")
404+
405+
method = getattr(s1, all_compare_operators)
406+
result = method(2)
407+
408+
method = getattr(s2, all_compare_operators)
409+
expected = method(2)
410+
411+
self.assert_series_equal(result, expected)
412+
392413

393414
class TestCasting:
394415
@pytest.mark.parametrize("dropna", [True, False])

pandas/tests/extension/test_integer.py

-21
Original file line numberDiff line numberDiff line change
@@ -168,27 +168,6 @@ def check_opname(self, s, op_name, other, exc=None):
168168
def _compare_other(self, s, data, op_name, other):
169169
self.check_opname(s, op_name, other)
170170

171-
def test_compare_to_string(self, any_nullable_int_dtype):
172-
# GH 28930
173-
s = pd.Series([1, None], dtype=any_nullable_int_dtype)
174-
result = s == "a"
175-
expected = pd.Series([False, False])
176-
177-
self.assert_series_equal(result, expected)
178-
179-
def test_compare_to_int(self, any_nullable_int_dtype, all_compare_operators):
180-
# GH 28930
181-
s1 = pd.Series([1, 2, 3], dtype=any_nullable_int_dtype)
182-
s2 = pd.Series([1, 2, 3], dtype="int")
183-
184-
method = getattr(s1, all_compare_operators)
185-
result = method(2)
186-
187-
method = getattr(s2, all_compare_operators)
188-
expected = method(2)
189-
190-
self.assert_series_equal(result, expected)
191-
192171

193172
class TestInterface(base.BaseInterfaceTests):
194173
pass

0 commit comments

Comments
 (0)