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

@@ -66,7 +66,7 @@ class ChoicesTests(SimpleTestCase):
def test_integerchoices_empty_label(self):
self.assertEqual(Vehicle.choices[0], (None, '(Unknown)'))
self.assertEqual(Vehicle.labels[0], '(Unknown)')
self.assertEqual(Vehicle.values[0], None)
self.assertIsNone(Vehicle.values[0])
self.assertEqual(Vehicle.names[0], '__empty__')
def test_integerchoices_functional_api(self):
@@ -107,7 +107,7 @@ class ChoicesTests(SimpleTestCase):
def test_textchoices_empty_label(self):
self.assertEqual(Gender.choices[0], (None, '(Undeclared)'))
self.assertEqual(Gender.labels[0], '(Undeclared)')
self.assertEqual(Gender.values[0], None)
self.assertIsNone(Gender.values[0])
self.assertEqual(Gender.names[0], '__empty__')
def test_textchoices_functional_api(self):