Added a test for NullBooleanField.formfield().

This commit is contained in:
Tim Graham 2016-12-19 18:47:30 -05:00
parent 09a7f121b5
commit e8d8fb3295
1 changed files with 5 additions and 0 deletions

View File

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