diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/regressiontests/model_fields/tests.py | 10 |
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 |
