Exemplo n.º 1
0
 def test_string_not_in_correct_date_format(self):
     with self.assertRaises(ValueError):
         validate.not_in_the_future('Narnteenth uv Septembah')
Exemplo n.º 2
0
 def test_before_1900_with_string_raises_exception(self):
     with self.assertRaises(ValueError):
         date_time = datetime(year=1899, month=6, day=6).strftime(DTF)
         validate.not_in_the_future(date_time)
Exemplo n.º 3
0
 def test_passing_false(self):
     with self.assertRaises(TypeError):
         validate.not_in_the_future(False)
Exemplo n.º 4
0
 def test_before_1900_with_datetime_does_not_raise_exception():
     validate.not_in_the_future(datetime(year=1899, month=6, day=6))
Exemplo n.º 5
0
 def test_one_second_in_the_future_does_raise_exception_with_string(self):
     with self.assertRaises(ValidationError):
         date_time = (datetime.now() + timedelta(seconds=1)).strftime(DTF)
         validate.not_in_the_future(date_time)
Exemplo n.º 6
0
 def test_one_second_in_the_future_does_raise_exception_with_datetime(self):
     with self.assertRaises(ValidationError):
         validate.not_in_the_future(datetime.now() + timedelta(seconds=1))
Exemplo n.º 7
0
 def test_now_does_not_raise_exception_with_string():
     validate.not_in_the_future(datetime.now().strftime(DTF))
Exemplo n.º 8
0
 def test_now_does_not_raise_exception_with_datetime():
     validate.not_in_the_future(datetime.now())