def test_before_raise_if_date_value_and_datetime_point_are_the_same(self): dbdt = SuperDate(dbdt=date(2020, 4, 3)) with self.assertRaises(ValidationException) as context: dbdt.validate() self.assertEqual(len(context.exception.keypath_messages), 1) self.assertEqual(context.exception.keypath_messages['dbdt'], "value is too late")
def test_before_raise_if_datetime_value_later_than_date_point(self): dtbd = SuperDate(dtbd=datetime(2020, 4, 4, 0, 0)) with self.assertRaises(ValidationException) as context: dtbd.validate() self.assertEqual(len(context.exception.keypath_messages), 1) self.assertEqual(context.exception.keypath_messages['dtbd'], "value is too late")
def test_after_raise_if_datetime_value_earlier_than_date_point(self): dtad = SuperDate(dtad=datetime(2020, 4, 2, 0, 0)) with self.assertRaises(ValidationException) as context: dtad.validate() self.assertEqual(len(context.exception.keypath_messages), 1) self.assertEqual(context.exception.keypath_messages['dtad'], "value is too early")
def test_after_raise_if_date_value_and_date_point_are_the_same(self): dad = SuperDate(dad=date(2020, 4, 3)) with self.assertRaises(ValidationException) as context: dad.validate() self.assertEqual(len(context.exception.keypath_messages), 1) self.assertEqual(context.exception.keypath_messages['dad'], "value is too early")
def test_before_does_not_raise_if_date_value_is_before_date_point(self): dbd = SuperDate(dbd=date(2020, 4, 2)) dbd.validate()
def test_before_does_not_raise_if_datetime_value_is_before_date_piont( self): dtbd = SuperDate(dtbd=datetime(2020, 4, 2, 12, 30)) dtbd.validate()
def test_before_does_not_raise_if_date_value_is_before_datetime_piont( self): dbdt = SuperDate(dbdt=date(2020, 4, 2)) dbdt.validate()
def test_after_dosent_raise_if_date_value_is_after_date_point(self): dad = SuperDate(dad=date(2020, 4, 4)) dad.validate()
def test_after_does_not_raise_if_date_value_is_after_types_date_piont(self): datd = SuperDate(datd=date(2020, 4, 4)) datd.validate()
def test_after_does_not_raise_if_date_value_is_after_callable_date_point(self): dacd = SuperDate(dacd=date(2020, 4, 4)) dacd.validate()
def test_after_dosent_raise_if_datetime_value_is_after_date_piont(self): dtad = SuperDate(dtad=datetime(2020, 4, 4, 12, 30)) dtad.validate()
def test_after_dosent_raise_if_date_value_is_after_datetime_piont(self): dadt = SuperDate(dadt=date(2020, 4, 4)) dadt.validate()