Author: ubernostrum Date: 2010-03-10 01:42:25 -0600 (Wed, 10 Mar 2010) New Revision: 12745
Modified: django/trunk/tests/regressiontests/model_fields/models.py django/trunk/tests/regressiontests/model_fields/tests.py Log: Tests for [12744], which were accidentally left out of the commit. Refs #13071. Modified: django/trunk/tests/regressiontests/model_fields/models.py =================================================================== --- django/trunk/tests/regressiontests/model_fields/models.py 2010-03-10 07:41:37 UTC (rev 12744) +++ django/trunk/tests/regressiontests/model_fields/models.py 2010-03-10 07:42:25 UTC (rev 12745) @@ -63,7 +63,11 @@ class Post(models.Model): title = models.CharField(max_length=100) body = models.TextField() - + +class NullBooleanModel(models.Model): + nbfield = models.NullBooleanField() + + ############################################################################### # ImageField Modified: django/trunk/tests/regressiontests/model_fields/tests.py =================================================================== --- django/trunk/tests/regressiontests/model_fields/tests.py 2010-03-10 07:41:37 UTC (rev 12744) +++ django/trunk/tests/regressiontests/model_fields/tests.py 2010-03-10 07:42:25 UTC (rev 12745) @@ -6,7 +6,7 @@ from django.db import models from django.core.exceptions import ValidationError -from models import Foo, Bar, Whiz, BigD, BigS, Image, BigInt, Post +from models import Foo, Bar, Whiz, BigD, BigS, Image, BigInt, Post, NullBooleanModel try: from decimal import Decimal @@ -40,6 +40,18 @@ form_field = model_field.formfield(show_hidden_initial=False) self.assertFalse(form_field.show_hidden_initial) + def test_nullbooleanfield_blank(self): + """ + Regression test for #13071: NullBooleanField should not throw + a validation error when given a value of None. + + """ + nullboolean = NullBooleanModel(nbfield=None) + try: + nullboolean.full_clean() + except ValidationError, e: + self.fail("NullBooleanField failed validation with value of None: %s" % e.messages) + class DecimalFieldTests(django.test.TestCase): def test_to_python(self): f = models.DecimalField(max_digits=4, decimal_places=2) -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.