def test_datetime_field_raises_error_message(self):
        f = models.DateTimeField()
        # Wrong format
        self.assertRaises(ValidationError, f.clean, 'foo', None)
        try:
            f.clean('foo', None)
        except ValidationError, e:
            self.assertEqual(e.messages, [
                u"'foo' value has an invalid format. It must be "
                u"in YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ] format."])

        # Correct format but invalid date
        self.assertRaises(ValidationError, f.clean, '2011-10-32', None)
        try:
            f.clean('2011-10-32', None)
        except __HOLE__, e:
            self.assertEqual(e.messages, [
                u"'2011-10-32' value has the correct format "
                u"(YYYY-MM-DD) but it is an invalid date."])

        # Correct format but invalid date/time
        self.assertRaises(ValidationError, f.clean, '2011-10-32 10:10', None)
        try:
            f.clean('2011-10-32 10:10', None)
        except ValidationError, e:
            self.assertEqual(e.messages, [
                u"'2011-10-32 10:10' value has the correct format "
                u"(YYYY-MM-DD HH:MM[:ss[.uuuuuu]][TZ]) "
                u"but it is an invalid date/time."])
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.4/tests/modeltests/validation/test_error_messages.py/ValidationMessagesTest.test_datetime_field_raises_error_message