Opened 7 years ago
Last modified 7 years ago
#28421 closed Cleanup/optimization
Formset test contain too many assert — at Initial Version
Reported by: | Windson yang | Owned by: | nobody |
---|---|---|---|
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
In
https://github.com/django/django/blob/master/tests/forms_tests/tests/test_formsets.py#L494
It contains
self.assertHTMLEqual( '\n'.join(form_output), """<li>Choice: <input type="text" name="choices-0-choice" value="Calexico" /></li> )
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'}, {}, ] )
and a lot of assert in the same function, maybe we should divide the function into multiple small tests.
Note:
See TracTickets
for help on using tickets.