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

@@ -479,8 +479,9 @@ class FileUploadTests(TestCase):
try:
self.client.post('/upload_errors/', post_data)
except reference_error.__class__ as err:
self.assertFalse(
str(err) == str(reference_error),
self.assertNotEqual(
str(err),
str(reference_error),
"Caught a repeated exception that'll cause an infinite loop in file uploads."
)
except Exception as err: