Exemple #1
0
 def test_string_not_in_correct_date_format(self):
     with self.assertRaises(ValueError):
         validate.not_in_the_future('Narnteenth uv Septembah')
Exemple #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)
Exemple #3
0
 def test_passing_false(self):
     with self.assertRaises(TypeError):
         validate.not_in_the_future(False)
Exemple #4
0
 def test_before_1900_with_datetime_does_not_raise_exception():
     validate.not_in_the_future(datetime(year=1899, month=6, day=6))
Exemple #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)
Exemple #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))
Exemple #7
0
 def test_now_does_not_raise_exception_with_string():
     validate.not_in_the_future(datetime.now().strftime(DTF))
Exemple #8
0
 def test_now_does_not_raise_exception_with_datetime():
     validate.not_in_the_future(datetime.now())