def test_parse_cache_entry_into_seconds(): # Values derived from http://www.epochconverter.com/ timestamps = OrderedDict() timestamps["1970-01-01T00:00:00.000Z"] = 0 timestamps["1970-04-26T17:46:40.375Z"] = 10000000.375 timestamps["2001-09-09T01:46:40.000Z"] = 1000000000 timestamps["2286-11-20T17:46:40.375Z"] = 10000000000.375 timestamps["2286-11-20T17:46:40.999Z"] = 10000000000.999 for stamp in timestamps.keys(): assert_equal(cache.iso_time_to_epoch(stamp), timestamps[stamp]) assert_equal(cache.epoch_time_to_iso(cache.iso_time_to_epoch(stamp)), stamp)
def test_cache_timestamps(): # test conversion to epoch time to ISO with proper rounding to millisecond assert_equal(cache.epoch_time_to_iso(1433544108.080841), '2015-06-05T22:41:48.081Z')