def test_roundtrip(self): now = self.app.now() roundtripped = from_timestamp(to_timestamp(now)) # we lose microseconds in the roundtrip, so we need to ignore them now = now.replace(microsecond=0) self.assertEqual(now, roundtripped)
def test_roundtrip(self): now = self.app.now() # 3.x returns naive, but 4.x returns aware now = maybe_make_aware(now) roundtripped = from_timestamp(to_timestamp(now)) # we lose microseconds in the roundtrip, so we need to ignore them now = now.replace(microsecond=0) self.assertEqual(now, roundtripped)
def test_score(self): run_every = 61*60 entry = self.create_entry(run_every=run_every) entry = entry._next_instance() score = entry.score expected = entry.last_run_at + timedelta(seconds=run_every) expected = expected.replace(microsecond=0) # discard microseconds, lost in timestamp self.assertEqual(score, to_timestamp(expected)) self.assertEqual(expected, from_timestamp(score))
def test_score(self): run_every = 61 * 60 entry = self.create_entry(run_every=run_every) entry = entry._next_instance() score = entry.score expected = entry.last_run_at + timedelta(seconds=run_every) expected = expected.replace(microsecond=0) # discard microseconds, lost in timestamp self.assertEqual(score, to_timestamp(expected)) self.assertEqual(expected, from_timestamp(score))