mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #7190. Boolean fields now return bool values instead of 1 or 0. Thanks, Alex Gaynor.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@12578 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -108,12 +108,22 @@ class BooleanFieldTests(unittest.TestCase):
|
||||
self.assertEqual(f.get_db_prep_lookup('exact', 0, connection=connection), [False])
|
||||
self.assertEqual(f.get_db_prep_lookup('exact', None, connection=connection), [None])
|
||||
|
||||
def _test_to_python(self, f):
|
||||
self.assertTrue(f.to_python(1) is True)
|
||||
self.assertTrue(f.to_python(0) is False)
|
||||
|
||||
def test_booleanfield_get_db_prep_lookup(self):
|
||||
self._test_get_db_prep_lookup(models.BooleanField())
|
||||
|
||||
def test_nullbooleanfield_get_db_prep_lookup(self):
|
||||
self._test_get_db_prep_lookup(models.NullBooleanField())
|
||||
|
||||
def test_booleanfield_to_python(self):
|
||||
self._test_to_python(models.BooleanField())
|
||||
|
||||
def test_nullbooleanfield_to_python(self):
|
||||
self._test_to_python(models.NullBooleanField())
|
||||
|
||||
def test_booleanfield_choices_blank(self):
|
||||
"""
|
||||
Test that BooleanField with choices and defaults doesn't generate a
|
||||
|
||||
Reference in New Issue
Block a user