def test_passthrough(self): """Establish that we pass through non-integer values as expected. """ dtf = DateTimeField() with mock.patch.object(models.DateTimeField, "to_python") as tp: dtf.to_python("2012-04-21 16:00:00+0000") tp.assert_called_once_with("2012-04-21 16:00:00+0000")
def test_passthrough(self): """Establish that we pass through non-integer values as expected. """ dtf = DateTimeField() with mock.patch.object(models.DateTimeField, 'to_python') as tp: dtf.to_python('2012-04-21 16:00:00+0000') tp.assert_called_once_with('2012-04-21 16:00:00+0000')
def test_int_without_use_tz(self): """Establish that if we send an integer to our datetime field subclass, that integers are accepted and return the value we expect. """ dtf = DateTimeField() answer = dtf.to_python(1335024000) self.assertEqual(answer, datetime(2012, 4, 21, 16))