Used more specific unittest assertions in tests.

* assertIsNone()/assertIsNotNone() instead of comparing to None.
* assertLess() for < comparisons.
* assertIs() for 'is' expressions.
* assertIsInstance() for isinstance() expressions.
* rounding of assertAlmostEqual() for round() expressions.
* assertIs(..., True/False) instead of comparing to True/False.
* assertIs()/assertIsNot() for ==/!= comparisons.
* assertNotEqual() for == comparisons.
* assertTrue()/assertFalse() instead of comparing to True/False.
This commit is contained in:
Nick Pope 2019-10-21 09:55:05 +01:00 committed by Mariusz Felisiak
parent a6cb8ec389
commit 7552de7866
18 changed files with 54 additions and 51 deletions

View file

@ -219,7 +219,7 @@ class DummyCacheTests(SimpleTestCase):
def test_get_or_set(self):
self.assertEqual(cache.get_or_set('mykey', 'default'), 'default')
self.assertEqual(cache.get_or_set('mykey', None), None)
self.assertIsNone(cache.get_or_set('mykey', None))
def test_get_or_set_callable(self):
def my_callable():
@ -947,7 +947,7 @@ class BaseCacheTests:
self.assertIsNone(cache.get('projector'))
self.assertEqual(cache.get_or_set('projector', 42), 42)
self.assertEqual(cache.get('projector'), 42)
self.assertEqual(cache.get_or_set('null', None), None)
self.assertIsNone(cache.get_or_set('null', None))
def test_get_or_set_callable(self):
def my_callable():