Opened 8 years ago
Closed 8 years ago
#28421 closed Cleanup/optimization (fixed)
Split up long formset tests
| Reported by: | Windson yang | Owned by: | Windson yang | 
|---|---|---|---|
| Component: | Forms | Version: | 1.11 | 
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | no | Needs documentation: | no | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description (last modified by )
In 
https://github.com/django/django/blob/master/tests/forms_tests/tests/test_formsets.py#L509
It contains
self.assertHTMLEqual(
            '\n'.join(form_output),
            """<li>Choice: <input type="text" name="choices-0-choice" value="Calexico" /></li>
<li>Votes: <input type="number" name="choices-0-votes" value="100" /></li>
<li>Delete: <input type="checkbox" name="choices-0-DELETE" /></li>
to check the output of formset, and also have 
self.assertTrue(formset.is_valid())
self.assertEqual(
            [form.cleaned_data for form in formset.forms],
            [
                {'votes': 100, 'DELETE': False, 'choice': 'Calexico'},
                {'votes': 900, 'DELETE': True, 'choice': 'Fergie'},
                {},
            ]
        )
to check the deletion.maybe we should divide the function into multiple small tests.
Change History (4)
comment:1 by , 8 years ago
| Description: | modified (diff) | 
|---|
comment:2 by , 8 years ago
| Summary: | Formset test contain too many assert → Split up long formset tests | 
|---|---|
| Triage Stage: | Unreviewed → Accepted | 
comment:3 by , 8 years ago
| Owner: | changed from to | 
|---|---|
| Status: | new → assigned | 
comment:4 by , 8 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | assigned → closed | 
  Note:
 See   TracTickets
 for help on using tickets.
    
In d04b3249: