def test_datetime_compare_nat(self):
dt_nat = np.datetime64('NaT', 'D')
dt_other = np.datetime64('2000-01-01')
td_nat = np.timedelta64('NaT', 'h')
td_other = np.timedelta64(1, 'h')
for op in [np.equal, np.less, np.less_equal,
np.greater, np.greater_equal]:
if op(dt_nat, dt_nat):
assert_warns(FutureWarning, op, dt_nat, dt_nat)
if op(dt_nat, dt_other):
assert_warns(FutureWarning, op, dt_nat, dt_other)
if op(dt_other, dt_nat):
assert_warns(FutureWarning, op, dt_other, dt_nat)
if op(td_nat, td_nat):
assert_warns(FutureWarning, op, td_nat, td_nat)
if op(td_nat, td_other):
assert_warns(FutureWarning, op, td_nat, td_other)
if op(td_other, td_nat):
assert_warns(FutureWarning, op, td_other, td_nat)
assert_warns(FutureWarning, np.not_equal, dt_nat, dt_nat)
assert_(np.not_equal(dt_nat, dt_other))
assert_(np.not_equal(dt_other, dt_nat))
assert_warns(FutureWarning, np.not_equal, td_nat, td_nat)
assert_(np.not_equal(td_nat, td_other))
assert_(np.not_equal(td_other, td_nat))
评论列表
文章目录