Skip to content

Commit 8884962

Browse files
moved and updated test
1 parent b85fae4 commit 8884962

File tree

2 files changed

+13
-34
lines changed

2 files changed

+13
-34
lines changed

pandas/tests/scalar/test_nat.py

+13
Original file line numberDiff line numberDiff line change
@@ -348,3 +348,16 @@ def test_to_numpy_alias():
348348
result = NaT.to_numpy()
349349

350350
assert isna(expected) and isna(result)
351+
352+
353+
@pytest.mark.parametrize("op", [
354+
lambda a, b: a > b, lambda a, b: a >= b,
355+
lambda a, b: a < b, lambda a, b: a <= b
356+
])
357+
@pytest.mark.parametrize("other", [
358+
Timedelta(0), Timestamp(0)
359+
])
360+
def test_nat_comparisons(op, other):
361+
# GH 26039
362+
assert op(NaT, other) is False
363+
assert op(other, NaT) is False

pandas/tests/scalar/timedelta/test_arithmetic.py

-34
Original file line numberDiff line numberDiff line change
@@ -689,37 +689,3 @@ def test_rdivmod_invalid(self):
689689
def test_td_op_timedelta_timedeltalike_array(self, op, arr):
690690
with pytest.raises(TypeError):
691691
op(arr, Timedelta('1D'))
692-
693-
694-
class TestTimedeltaCompare():
695-
"""
696-
Tests for Timedelta comparisons.
697-
"""
698-
699-
def test_timedelta_nat_comparisons(self):
700-
# GH 26039
701-
td = pd.Timedelta(0)
702-
703-
result = td > NaT
704-
assert result is False
705-
706-
result = td >= NaT
707-
assert result is False
708-
709-
result = td < NaT
710-
assert result is False
711-
712-
result = td <= NaT
713-
assert result is False
714-
715-
result = NaT > td
716-
assert result is False
717-
718-
result = NaT >= td
719-
assert result is False
720-
721-
result = NaT < td
722-
assert result is False
723-
724-
result = NaT <= td
725-
assert result is False

0 commit comments

Comments
 (0)