'Check that a BooleanField defaults to None -- which isn\'t
a valid value (#15124).'

def test_null_default(self):

    boolean_field = BooleanModel._meta.get_field(u'bfield')
    self.assertTrue(boolean_field.has_default())
    old_default = boolean_field.default
    try:
        boolean_field.default = models.NOT_PROVIDED
        self.assertFalse(boolean_field.has_default())
        b = BooleanModel()
        self.assertIsNone(b.bfield)
        with self.assertRaises(IntegrityError):
            b.save()
    finally:
        boolean_field.default = old_default
    nb = NullBooleanModel()
    self.assertIsNone(nb.nbfield)
    nb.save()
