Opened 10 years ago
Last modified 10 years ago
#24714 closed Cleanup/optimization
Tidy up usage of assertEqual in tests — at Initial Version
Reported by: | Alasdair Nicol | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | 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: | no | UI/UX: | no |
Description
There are a few places in the tests where we are using self.assertEqual that could be more idiomatic.
self.assertEqual(True, x) # prefer self.assertTrue(x) self.assertEqual(False, x) # prefer self.assertFalse(x) self.assertEqual(None, x) # prefer self.assertIsNone(x) self.assertEqual(True, x in y) # prefer self.assertIn(x, y) self.assertEqual(True, x == y) # prefer self.assertEqual(x, y) self.assertEqual(False, x == y) # prefer self.assertNotEqual(x, y)
I found these using the following greps
grep -rI assertEqual.True grep -rI assertEqual.False grep -rI assertEqual.None
This is a similar tidy up to #23620
Note:
See TracTickets
for help on using tickets.