Skip to content

Commit 89185f5

Browse files
committed
Add __ne__ method to ArrowPeriodType and ArrowIntervalType
1 parent 48a19e8 commit 89185f5

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

pandas/core/arrays/arrow/extension_types.py

+6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ def __eq__(self, other):
3535
else:
3636
return NotImplemented
3737

38+
def __ne__(self, other) -> bool:
39+
return not self.__eq__(other)
40+
3841
def __hash__(self) -> int:
3942
return hash((str(self), self.freq))
4043

@@ -91,6 +94,9 @@ def __eq__(self, other):
9194
else:
9295
return NotImplemented
9396

97+
def __ne__(self, other) -> bool:
98+
return not self.__eq__(other)
99+
94100
def __hash__(self) -> int:
95101
return hash((str(self), str(self.subtype), self.closed))
96102

pandas/tests/arrays/interval/test_interval.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def test_arrow_extension_type():
256256

257257
assert p1.closed == "left"
258258
assert p1 == p2
259-
assert not p1 == p3 # pylint: disable=unneeded-not
259+
assert p1 != p3
260260
assert hash(p1) == hash(p2)
261261
assert hash(p1) != hash(p3)
262262

pandas/tests/arrays/period/test_arrow_compat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def test_arrow_extension_type():
2121

2222
assert p1.freq == "D"
2323
assert p1 == p2
24-
assert not p1 == p3 # pylint: disable=unneeded-not
24+
assert p1 != p3
2525
assert hash(p1) == hash(p2)
2626
assert hash(p1) != hash(p3)
2727

0 commit comments

Comments
 (0)