def test_date_in_future(self): """ Tests that the custom_validators.date_not_in_future throws an exception when the date is in the future """ tomorrow = date.today() + timedelta(days=1) with self.assertRaises(ValidationError) as ctx: custom_validators.date_not_in_future(tomorrow)
def test_date_not_in_future(self): """ Tests that the custom_validators.date_not_in_future function works as expected for current and past dates """ # No exception should be thrown custom_validators.date_not_in_future(date.today()) # No exception should be thrown custom_validators.date_not_in_future(date.today() - timedelta(days=1))