Opened 10 years ago
Closed 10 years ago
#23620 closed Cleanup/optimization (fixed)
Use more specific assertions than assertTrue in tests
Description ¶
We should change things like self.assertTrue(fetched.active_translation.title == 'Otsikko')
to use assertEqual
and things like self.assertTrue('id' in form.fields)
to use assertIn
. Attaching an initial patch. I used grep -rI "assertTrue" * | grep ==
to find instances that need changing.
Change History (6)
by , 10 years ago
Attachment: | 23620.diff added |
---|
comment:1 by , 10 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 10 years ago
Summary: | Use more specify assertions than assertTrue in tests → Use more specific assertions than assertTrue in tests |
---|
comment:3 by , 10 years ago
comment:5 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Note:
See TracTickets
for help on using tickets.
https://github.com/django/django/pull/3432
Should I create a new ticket for
assertFalse(a == b)
,assertFalse(a != b)
,assertFalse("foo" in a)
etc. instances?