From ad237fb72f769bbd99b5ed6e3292bead614e1c94 Mon Sep 17 00:00:00 2001 From: Brendan MacDonell Date: Mon, 6 Aug 2012 10:42:21 +0200 Subject: Fixed #18724 -- Fixed IntegerField validation with value 0 --- tests/regressiontests/model_fields/tests.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'tests/regressiontests/model_fields') diff --git a/tests/regressiontests/model_fields/tests.py b/tests/regressiontests/model_fields/tests.py index e86159463d..7d6071accc 100644 --- a/tests/regressiontests/model_fields/tests.py +++ b/tests/regressiontests/model_fields/tests.py @@ -274,6 +274,10 @@ class ValidationTest(test.TestCase): self.assertRaises(ValidationError, f.clean, None, None) self.assertRaises(ValidationError, f.clean, '', None) + def test_integerfield_validates_zero_against_choices(self): + f = models.IntegerField(choices=((1, 1),)) + self.assertRaises(ValidationError, f.clean, '0', None) + def test_charfield_raises_error_on_empty_input(self): f = models.CharField(null=False) self.assertRaises(ValidationError, f.clean, None, None) -- cgit v1.3