Ticket #26283: 26283-test.diff

File 26283-test.diff, 1022 bytes (added by Tim Graham, 9 years ago)
  • tests/postgres_tests/test_array.py

    diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py
    index 5df25c1..6582723 100644
    a b class TestSplitFormField(PostgreSQLTestCase):  
    643643        self.assertTrue(form.is_valid(), form.errors)
    644644        self.assertEqual(form.cleaned_data, {'array': ['a', '', 'b']})
    645645
     646    def test_remove_trailing_nulls_not_required(self):
     647        class SplitForm(forms.Form):
     648            array = SplitArrayField(
     649                forms.CharField(required=False),
     650                size=2,
     651                remove_trailing_nulls=True,
     652                required=False,
     653            )
     654
     655        data = {'array_0': '', 'array_1': ''}
     656        form = SplitForm(data)
     657        self.assertTrue(form.is_valid())
     658        self.assertEqual(form.cleaned_data, {'array': ['', '']})
     659
    646660    def test_required_field(self):
    647661        class SplitForm(forms.Form):
    648662            array = SplitArrayField(forms.CharField(), size=3)
Back to Top