def test_normalization(self): field = DateTimeField() dt = field.normalize('09/30/2000 00:00:00') self.assertEqual(datetime.datetime(2000, 9, 30, 3, 0, 0), dt) dt = field.normalize('09/30/2000 23:00:00') datetime_datetime = datetime.datetime(2000, 10, 1, 2, 0, 0) self.assertEqual(datetime_datetime, dt) self.assertEqual(datetime_datetime, field.normalize(datetime_datetime))
def test_date_assignment(self): field = DateTimeField() field._set_attr_name('d') date = datetime.datetime(2000, 9, 30) dt = field.normalize(date) self.assertEqual(date, dt)