1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +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:
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

@@ -250,7 +250,7 @@ class TestUtilsText(SimpleTestCase):
actual_length = len(b''.join(seq))
out = text.compress_sequence(seq)
compressed_length = len(b''.join(out))
self.assertTrue(compressed_length < actual_length)
self.assertLess(compressed_length, actual_length)
def test_format_lazy(self):
self.assertEqual('django/test', format_lazy('{}/{}', 'django', lazystr('test')))