Opened 7 years ago
Closed 7 years ago
#30358 closed Cleanup/optimization (fixed)
Remove redundant assertion from django/tests/forms_tests/tests/test_utils.py.
| Reported by: | Petru-Florin Mihancea | Owned by: | Krisjanis Vaiders |
|---|---|---|---|
| Component: | Forms | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Ready for checkin | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
While experimenting with a CodeSonar plugin we develop, we noticed a potential bug in file "django/tests/forms_tests/tests/test_utils.py" line 154 function test_error_dict_copy.
e_deepcopy = copy.deepcopy(e)
self.assertEqual(e, e_deepcopy)
self.assertEqual(e.as_data(), e_copy.as_data()) HERE
Shouldn't you get the data from e_deepcopy in that line (instead the data of e_copy)?
Thanks,
Petru-Florin Mihancea
Change History (5)
comment:1 by , 7 years ago
| Easy pickings: | set |
|---|---|
| Summary: | Possible access to unintended variable in "django/tests/forms_tests/tests/test_utils.py" line 154 → Remove redundant assertion from django/tests/forms_tests/tests/test_utils.py. |
| Triage Stage: | Unreviewed → Accepted |
| Type: | Bug → Cleanup/optimization |
comment:2 by , 7 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:4 by , 7 years ago
| Triage Stage: | Accepted → Ready for checkin |
|---|
Note:
See TracTickets
for help on using tickets.
Thanks for the report. With
e_deepcopyassertion fails, becausedeepcopy()creates copies ofValidationError. IMO we should just remove this redundant assertion.