Exemplo n.º 1
0
 def test_future_ok(self):
     year = int(datetime.datetime.utcnow().strftime("%Y"))
     for f in [f"Jan 2 12:00 {year+1}", f"Dec 31 00:00 {year+1}"]:
         self.assertTrue(
             isinstance(validatorfuncs.future(f, from_tz=pytz.UTC),
                        datetime.datetime))
Exemplo n.º 2
0
 def test_future_raises_ValueError(self):
     year = int(datetime.datetime.utcnow().strftime("%Y"))
     for f in [f"Jan 2 12:00 {year-1}", f"Dec 31 00:00 {year-1}"]:
         with self.assertRaises(ValueError):
             validatorfuncs.future(f, from_tz=pytz.UTC)
Exemplo n.º 3
0
 def validate(self, value, **kwargs):
     return validatorfuncs.future(value, option_key=self.key, **kwargs)