def test_timestampfield_2(self): f = TimeStampField(null=True) assert None == f.clean(None) pytest.raises(ValidationError, f.clean, 'abc') pytest.raises(ValidationError, f.clean, 'Wed Aug 29 17:12:58 +0000 2012') assert datetime.datetime(1970, 1, 1, 0, 2, 3, tzinfo=utc) == f.clean(123) assert datetime.datetime(2013, 11, 24, 18, 43, tzinfo=utc) == f.clean(datetime.datetime(2013, 11, 24, 18, 43, tzinfo=utc))
def test_timestampfield_2(self): f = TimeStampField(null=True) self.assertEqual(None, f.clean(None)) self.assertRaises(ValidationError, f.clean, 'abc') self.assertRaises(ValidationError, f.clean, 'Wed Aug 29 17:12:58 +0000 2012') self.assertEqual(datetime.datetime(1970, 1, 1, 0, 2, 3, tzinfo=utc), f.clean(123)) self.assertEqual(datetime.datetime(2013, 11, 24, 18, 43, tzinfo=utc), f.clean(datetime.datetime(2013, 11, 24, 18, 43, tzinfo=utc)))
def test_timestampfield_2(self): f = TimeStampField(null=True) assert f.clean(None) is None pytest.raises(ValidationError, f.clean, 'abc') pytest.raises(ValidationError, f.clean, 'Wed Aug 29 17:12:58 +0000 2012') assert datetime.datetime(1970, 1, 1, 0, 2, 3, tzinfo=utc) == f.clean(123) assert datetime.datetime(2013, 11, 24, 18, 43, tzinfo=utc) == f.clean( datetime.datetime(2013, 11, 24, 18, 43, tzinfo=utc))
def test_timestampfield_2(self): f = TimeStampField(null=True) self.assertEqual(None, f.clean(None)) self.assertRaises(ValidationError, f.clean, 'abc') self.assertRaises(ValidationError, f.clean, 'Wed Aug 29 17:12:58 +0000 2012') self.assertEqual(datetime.datetime(1970, 1, 1, 0, 2, 3, tzinfo=utc), f.clean(123)) self.assertEqual( datetime.datetime(2013, 11, 24, 18, 43, tzinfo=utc), f.clean(datetime.datetime(2013, 11, 24, 18, 43, tzinfo=utc)))