From 64a9115bcecf48bce2e7a84d165a6628e2ce607c Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Mon, 26 Oct 2015 19:37:47 -0400 Subject: [1.9.x] Fixed #25597 -- Fixed crash with SplitArrayField and IntegerField on invalid value. Backport of 1f07da3e29c7c3d47968e1c4531dd9bf902575b7 from master --- tests/postgres_tests/test_array.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/postgres_tests') diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py index fbc15bb2ac..9f982178c7 100644 --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -509,6 +509,11 @@ class TestSplitFormField(PostgreSQLTestCase): self.assertFalse(form.is_valid()) self.assertEqual(form.errors, {'array': ['Item 2 in the array did not validate: This field is required.']}) + def test_invalid_integer(self): + msg = 'Item 1 in the array did not validate: Ensure this value is less than or equal to 100.' + with self.assertRaisesMessage(exceptions.ValidationError, msg): + SplitArrayField(forms.IntegerField(max_value=100), size=2).clean([0, 101]) + def test_rendering(self): class SplitForm(forms.Form): array = SplitArrayField(forms.CharField(), size=3) -- cgit v1.3