Opened 7 years ago

Closed 7 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 Windson yang)

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 Windson yang, 7 years ago

Description: modified (diff)

comment:2 by Tim Graham, 7 years ago

Summary: Formset test contain too many assertSplit up long formset tests
Triage Stage: UnreviewedAccepted

comment:3 by Windson yang, 7 years ago

Owner: changed from nobody to Windson yang
Status: newassigned

comment:4 by Tim Graham <timograham@…>, 7 years ago

Resolution: fixed
Status: assignedclosed

In d04b3249:

Fixed #28421 -- Split some long FormSet tests and made other cosmetic cleanups.

Thanks Windson for the initial patch.

Note: See TracTickets for help on using tickets.
Back to Top