summaryrefslogtreecommitdiff
path: root/tests/postgres_tests/test_array.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/postgres_tests/test_array.py')
-rw-r--r--tests/postgres_tests/test_array.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py
index f5c333e56f..670c98e7a7 100644
--- a/tests/postgres_tests/test_array.py
+++ b/tests/postgres_tests/test_array.py
@@ -663,6 +663,20 @@ class TestSplitFormField(PostgreSQLTestCase):
self.assertTrue(form.is_valid(), form.errors)
self.assertEqual(form.cleaned_data, {'array': ['a', '', 'b']})
+ def test_remove_trailing_nulls_not_required(self):
+ class SplitForm(forms.Form):
+ array = SplitArrayField(
+ forms.CharField(required=False),
+ size=2,
+ remove_trailing_nulls=True,
+ required=False,
+ )
+
+ data = {'array_0': '', 'array_1': ''}
+ form = SplitForm(data)
+ self.assertTrue(form.is_valid())
+ self.assertEqual(form.cleaned_data, {'array': []})
+
def test_required_field(self):
class SplitForm(forms.Form):
array = SplitArrayField(forms.CharField(), size=3)