1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed a couple of assert syntax warnings mistakingly introduced in r16966 and added some tests to prevent future regressions. Thanks to Anssi Kääriäinen for the report.

Refs #12467.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16971 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Julien Phalip
2011-10-13 11:53:59 +00:00
parent 639400d52f
commit c58e5724bc
3 changed files with 20 additions and 4 deletions

View File

@@ -12,6 +12,12 @@ class ValidationMessagesTest(TestCase):
f.clean('foo', None)
except ValidationError, e:
self.assertEqual(e.messages, [u"'foo' value must be an integer."])
# primary_key must be True. Refs #12467.
self.assertRaises(AssertionError, models.AutoField, 'primary_key', False)
try:
models.AutoField(primary_key=False)
except AssertionError, e:
self.assertEqual(e.message, u"AutoFields must have primary_key=True.")
def test_integer_field_raises_error_message(self):
f = models.IntegerField()