Ticket #26129: 26129-test.diff

File 26129-test.diff, 823 bytes (added by Tim Graham, 5 years ago)
  • tests/forms_tests/tests/test_forms.py

    diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py
    index 917b5c9..00d2045 100644
    a b class FormsTestCase(SimpleTestCase): 
    718718                {'birthday': datetime.date(1974, 8, 16), 'name': 'John Doe'}
    719719            )
    720720
     721        # Initial data remains present on invalid forms.
     722        data = {}
     723        f1 = PersonForm(data, initial={'birthday': datetime.date(1974, 8, 16)})
     724        f2 = PersonFormFieldInitial(data)
     725        for form in (f1, f2):
     726            self.assertFalse(form.is_valid())
     727            self.assertEqual(form['birthday'].value(), datetime.date(1974, 8, 16))
     728
    721729    def test_hidden_data(self):
    722730        class SongForm(Form):
    723731            name = CharField()
Back to Top