From 57fafad8d8d12ca5041336b2de37c0aea02275fa Mon Sep 17 00:00:00 2001 From: Irv Lustig Date: Thu, 23 Jan 2020 10:50:42 -0500 Subject: [PATCH] TST: Fix timestamp comparison test --- pandas/tests/scalar/timestamp/test_timestamp.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pandas/tests/scalar/timestamp/test_timestamp.py b/pandas/tests/scalar/timestamp/test_timestamp.py index f1fcf46a936fd..2f3175598d592 100644 --- a/pandas/tests/scalar/timestamp/test_timestamp.py +++ b/pandas/tests/scalar/timestamp/test_timestamp.py @@ -751,7 +751,7 @@ def test_asm8(self): def test_class_ops_pytz(self): def compare(x, y): - assert int(Timestamp(x).value / 1e9) == int(Timestamp(y).value / 1e9) + assert int((Timestamp(x).value - Timestamp(y).value) / 1e9) == 0 compare(Timestamp.now(), datetime.now()) compare(Timestamp.now("UTC"), datetime.now(timezone("UTC"))) @@ -775,8 +775,12 @@ def compare(x, y): def test_class_ops_dateutil(self): def compare(x, y): - assert int(np.round(Timestamp(x).value / 1e9)) == int( - np.round(Timestamp(y).value / 1e9) + assert ( + int( + np.round(Timestamp(x).value / 1e9) + - np.round(Timestamp(y).value / 1e9) + ) + == 0 ) compare(Timestamp.now(), datetime.now())