Skip to content

Commit cee2081

Browse files
meeseeksmachineDr-Irv
authored andcommitted
Backport PR #31249: TST: Fix timestamp comparison test (#31265)
Co-authored-by: Irv Lustig <[email protected]>
1 parent 29edc79 commit cee2081

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pandas/tests/scalar/timestamp/test_timestamp.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ def test_asm8(self):
751751

752752
def test_class_ops_pytz(self):
753753
def compare(x, y):
754-
assert int(Timestamp(x).value / 1e9) == int(Timestamp(y).value / 1e9)
754+
assert int((Timestamp(x).value - Timestamp(y).value) / 1e9) == 0
755755

756756
compare(Timestamp.now(), datetime.now())
757757
compare(Timestamp.now("UTC"), datetime.now(timezone("UTC")))
@@ -775,8 +775,12 @@ def compare(x, y):
775775

776776
def test_class_ops_dateutil(self):
777777
def compare(x, y):
778-
assert int(np.round(Timestamp(x).value / 1e9)) == int(
779-
np.round(Timestamp(y).value / 1e9)
778+
assert (
779+
int(
780+
np.round(Timestamp(x).value / 1e9)
781+
- np.round(Timestamp(y).value / 1e9)
782+
)
783+
== 0
780784
)
781785

782786
compare(Timestamp.now(), datetime.now())

0 commit comments

Comments
 (0)