summaryrefslogtreecommitdiff
path: root/tests/regressiontests/model_fields
diff options
context:
space:
mode:
authorJoseph Kocherhans <joseph@jkocherhans.com>2010-02-24 17:36:18 +0000
committerJoseph Kocherhans <joseph@jkocherhans.com>2010-02-24 17:36:18 +0000
commit16fe73d918c8a35f7122aed858312bd3163ac454 (patch)
tree06c8c09da94ae39e91735feb581139a2c242a138 /tests/regressiontests/model_fields
parent9f4bf525f887db32b7260909a0140d68910aa042 (diff)
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
Diffstat (limited to 'tests/regressiontests/model_fields')
-rw-r--r--tests/regressiontests/model_fields/tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/regressiontests/model_fields/tests.py b/tests/regressiontests/model_fields/tests.py
index 18bfbd37ee..2ac0af3267 100644
--- a/tests/regressiontests/model_fields/tests.py
+++ b/tests/regressiontests/model_fields/tests.py
@@ -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