From e8d8fb3295ee6d34fc8430fbf264b997335db390 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 19 Dec 2016 18:47:30 -0500 Subject: [PATCH] Added a test for NullBooleanField.formfield(). --- tests/model_fields/test_booleanfield.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/model_fields/test_booleanfield.py b/tests/model_fields/test_booleanfield.py index f61be4e28a9..f295f24980a 100644 --- a/tests/model_fields/test_booleanfield.py +++ b/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()