def test_interval_similarity(self): interval_a = IntervalTrigger(timedelta(hours=1), datetime.now()) interval_b = IntervalTrigger(timedelta(minutes=60), datetime.now()) interval_c = IntervalTrigger(timedelta(seconds=60*60), datetime.now() + timedelta(hours=1)) interval_d = IntervalTrigger(timedelta(seconds=1), datetime.now()) self.assertTrue(triggers_are_identical(interval_a, interval_a)) self.assertTrue(triggers_are_identical(interval_a, interval_b)) self.assertTrue(triggers_are_identical(interval_a, interval_c)) self.assertFalse(triggers_are_identical(interval_a, interval_d))
def test_crontab_similarity(self): crontab_a = crontab(hour=1) crontab_b = crontab(minute=10) crontab_c = crontab(hour=2) crontab_d = crontab(hour=2) crontab_e = crontab(hour=2, start_date=datetime.now() + timedelta(days=2)) self.assertTrue(triggers_are_identical(crontab_a, crontab_a)) self.assertFalse(triggers_are_identical(crontab_a, crontab_b)) self.assertFalse(triggers_are_identical(crontab_a, crontab_c)) self.assertTrue(triggers_are_identical(crontab_c, crontab_d)) self.assertFalse(triggers_are_identical(crontab_c, crontab_e))