コード例 #1
0
ファイル: test_utils.py プロジェクト: REVLWorld/redbeat
    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)
コード例 #2
0
ファイル: test_utils.py プロジェクト: mmadsen/redbeat
    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)
コード例 #3
0
ファイル: test_utils.py プロジェクト: yogevyuval/redbeat
    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)
コード例 #4
0
ファイル: test_entry.py プロジェクト: REVLWorld/redbeat
    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))
コード例 #5
0
ファイル: test_entry.py プロジェクト: gquisumbing/redbeat
    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))