Fixed #29227 -- Allowed BooleanField to be null=True.

Thanks Lynn Cyrin for contributing to the patch, and Nick Pope for review.
This commit is contained in:
Tim Graham 2017-05-06 10:56:28 -04:00
parent 73f7d1755f
commit 5fa4f40f45
32 changed files with 158 additions and 98 deletions

View file

@ -820,6 +820,19 @@ class CaseExpressionTests(TestCase):
transform=attrgetter('integer', 'null_boolean')
)
def test_update_null_boolean_old(self):
CaseTestModel.objects.update(
null_boolean_old=Case(
When(integer=1, then=True),
When(integer=2, then=False),
),
)
self.assertQuerysetEqual(
CaseTestModel.objects.all().order_by('pk'),
[(1, True), (2, False), (3, None), (2, False), (3, None), (3, None), (4, None)],
transform=attrgetter('integer', 'null_boolean_old')
)
def test_update_positive_integer(self):
CaseTestModel.objects.update(
positive_integer=Case(