Skip to content

Commit 4c8ad82

Browse files
committed
Merge pull request #4592 from Komnomnomnom/ujson-date-explosion
TST: fix ujson's intermittently failing date unit test
2 parents 68dfe52 + 71b763b commit 4c8ad82

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

pandas/io/tests/test_json/test_ujson.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -356,20 +356,19 @@ def test_npy_nat(self):
356356
assert ujson.encode(input) == 'null', "Expected null"
357357

358358
def test_datetime_units(self):
359-
raise nose.SkipTest("skipping for now, test is buggy, pls fix me")
360359
from pandas.lib import Timestamp
361360

362-
val = datetime.datetime.now()
361+
val = datetime.datetime(2013, 8, 17, 21, 17, 12, 215504)
363362
stamp = Timestamp(val)
364363

365364
roundtrip = ujson.decode(ujson.encode(val, date_unit='s'))
366-
self.assert_(roundtrip == stamp.value // 1e9)
365+
self.assert_(roundtrip == stamp.value // 10**9)
367366

368367
roundtrip = ujson.decode(ujson.encode(val, date_unit='ms'))
369-
self.assert_(roundtrip == stamp.value // 1e6)
368+
self.assert_(roundtrip == stamp.value // 10**6)
370369

371370
roundtrip = ujson.decode(ujson.encode(val, date_unit='us'))
372-
self.assert_(roundtrip == stamp.value / 1e3)
371+
self.assert_(roundtrip == stamp.value // 10**3)
373372

374373
roundtrip = ujson.decode(ujson.encode(val, date_unit='ns'))
375374
self.assert_(roundtrip == stamp.value)

0 commit comments

Comments
 (0)