Browse Source

Added a test for NullBooleanField.formfield().

Tim Graham 8 years ago
parent
commit
e8d8fb3295
1 changed files with 5 additions and 0 deletions
  1. 5 0
      tests/model_fields/test_booleanfield.py

+ 5 - 0
tests/model_fields/test_booleanfield.py

@@ -1,3 +1,4 @@
+from django import forms
 from django.core.exceptions import ValidationError
 from django.db import IntegrityError, models, transaction
 from django.test import SimpleTestCase, TestCase
@@ -40,6 +41,10 @@ class BooleanFieldTests(TestCase):
         f = models.BooleanField(choices=choices, default=1, null=False)
         self.assertEqual(f.formfield().choices, choices)
 
+    def test_nullbooleanfield_formfield(self):
+        f = models.NullBooleanField()
+        self.assertIsInstance(f.formfield(), forms.NullBooleanField)
+
     def test_return_type(self):
         b = BooleanModel.objects.create(bfield=True)
         b.refresh_from_db()