Esempio n. 1
0
 def test_within_due_on_utc_16h(self) -> None:
     predicate = DueWithin("16h", timezone.utc)
     self._test_multiple_dates(
         predicate,
         lambda due_on: f.task(due_at=None, due_on=due_on),
         [
             (date(2019, 1, 2), False),
             (date(2019, 1, 3), True),
             (date(2019, 1, 4), False),
         ],
     )
Esempio n. 2
0
 def test_within_due_at_16h(self) -> None:
     predicate = DueWithin("16h", timezone.utc)
     self._test_multiple_dates(
         predicate,
         lambda due_at: f.task(due_at=due_at.replace(tzinfo=timezone.utc)),
         [
             (datetime(2019, 1, 2, 0, 0, 0), False),
             (datetime(2019, 1, 3, 6, 0, 0), True),
             (datetime(2019, 1, 3, 22, 0, 0), True),
             (datetime(2019, 1, 4, 0, 0, 0), False),
         ],
     )
Esempio n. 3
0
 def test_within_due_on_pst_1d(self) -> None:
     predicate = DueWithin("1d", PST)
     self._test_multiple_dates(
         predicate,
         lambda due_on: f.task(due_at=None, due_on=due_on),
         [
             (date(2019, 1, 1), False),
             (date(2019, 1, 2), True),
             (date(2019, 1, 3), True),
             (date(2019, 1, 4), False),
         ],
     )
Esempio n. 4
0
 def test_no_due_date(self) -> None:
     client = create_autospec(Client)
     task = f.task(due_at=None, due_on=None)
     due_within = DueWithin("0h", timezone.utc)
     self.assertFalse(due_within(task, client))