mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
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:
parent
a6cb8ec389
commit
7552de7866
18 changed files with 54 additions and 51 deletions
4
tests/cache/tests.py
vendored
4
tests/cache/tests.py
vendored
|
@ -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():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue