Skip to content

Commit 4d4c017

Browse files
Fix floating point imprecision with np.timedelta64
1 parent f049ac2 commit 4d4c017

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pandas/tests/io/sas/test_sas7bdat.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import numpy as np
88
import pytest
99

10-
from pandas.compat import IS64
10+
from pandas.compat import IS64, WASM
1111
from pandas.errors import EmptyDataError
1212

1313
import pandas as pd
@@ -190,7 +190,7 @@ def test_date_time(datapath):
190190
res = df0["DateTimeHi"].astype("M8[us]").dt.round("ms")
191191
df0["DateTimeHi"] = res.astype("M8[ms]")
192192

193-
if not IS64:
193+
if (not IS64) or (WASM):
194194
# No good reason for this, just what we get on the CI
195195
df0.loc[0, "DateTimeHi"] += np.timedelta64(1, "ms")
196196
df0.loc[[2, 3], "DateTimeHi"] -= np.timedelta64(1, "ms")
@@ -285,7 +285,7 @@ def test_max_sas_date(datapath):
285285
columns=["text", "dt_as_float", "dt_as_dt", "date_as_float", "date_as_date"],
286286
)
287287

288-
if not IS64:
288+
if (not IS64) or (WASM):
289289
# No good reason for this, just what we get on the CI
290290
expected.loc[:, "dt_as_dt"] -= np.timedelta64(1, "ms")
291291

@@ -328,7 +328,7 @@ def test_max_sas_date_iterator(datapath):
328328
columns=col_order,
329329
),
330330
]
331-
if not IS64:
331+
if (not IS64) or (WASM):
332332
# No good reason for this, just what we get on the CI
333333
expected[0].loc[0, "dt_as_dt"] -= np.timedelta64(1, "ms")
334334
expected[1].loc[0, "dt_as_dt"] -= np.timedelta64(1, "ms")
@@ -359,7 +359,7 @@ def test_null_date(datapath):
359359
),
360360
},
361361
)
362-
if not IS64:
362+
if (not IS64) or (WASM):
363363
# No good reason for this, just what we get on the CI
364364
expected.loc[0, "datetimecol"] -= np.timedelta64(1, "ms")
365365
tm.assert_frame_equal(df, expected)

0 commit comments

Comments
 (0)