Skip to content
Merged
Show file tree
Hide file tree
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
21 changes: 21 additions & 0 deletions pandas/tests/arrays/test_integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,27 @@ def test_compare_array(self, data, all_compare_operators):
other = pd.Series([0] * len(data))
self._compare_other(data, op_name, other)

def test_compare_to_string(self, any_nullable_int_dtype):
# GH 28930
s = pd.Series([1, None], dtype=any_nullable_int_dtype)
result = s == "a"
expected = pd.Series([False, False])

self.assert_series_equal(result, expected)

def test_compare_to_int(self, any_nullable_int_dtype, all_compare_operators):
# GH 28930
s1 = pd.Series([1, 2, 3], dtype=any_nullable_int_dtype)
s2 = pd.Series([1, 2, 3], dtype="int")

method = getattr(s1, all_compare_operators)
result = method(2)

method = getattr(s2, all_compare_operators)
expected = method(2)

self.assert_series_equal(result, expected)


class TestCasting:
@pytest.mark.parametrize("dropna", [True, False])
Expand Down
21 changes: 0 additions & 21 deletions pandas/tests/extension/test_integer.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,27 +168,6 @@ def check_opname(self, s, op_name, other, exc=None):
def _compare_other(self, s, data, op_name, other):
self.check_opname(s, op_name, other)

def test_compare_to_string(self, any_nullable_int_dtype):
# GH 28930
s = pd.Series([1, None], dtype=any_nullable_int_dtype)
result = s == "a"
expected = pd.Series([False, False])

self.assert_series_equal(result, expected)

def test_compare_to_int(self, any_nullable_int_dtype, all_compare_operators):
# GH 28930
s1 = pd.Series([1, 2, 3], dtype=any_nullable_int_dtype)
s2 = pd.Series([1, 2, 3], dtype="int")

method = getattr(s1, all_compare_operators)
result = method(2)

method = getattr(s2, all_compare_operators)
expected = method(2)

self.assert_series_equal(result, expected)


class TestInterface(base.BaseInterfaceTests):
pass
Expand Down