summaryrefslogtreecommitdiff
path: root/tests/model_forms
diff options
context:
space:
mode:
authorJon Dufresne <jon.dufresne@gmail.com>2016-06-16 11:19:18 -0700
committerTim Graham <timograham@gmail.com>2016-06-16 14:21:14 -0400
commit13d60298ea2a07242dc3952a9dfcd9c8857bf1f9 (patch)
tree230d0f843401781e9b2062fe3c1f929655a5527e /tests/model_forms
parent70b7d6b4ea0cbd67406d193f0a7fed7e290d1eb6 (diff)
[1.10.x] Fixed #26747 -- Used more specific assertions in the Django test suite.
Backport of 4f336f66523001b009ab038b10848508fd208b3b from master
Diffstat (limited to 'tests/model_forms')
-rw-r--r--tests/model_forms/tests.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py
index 193b5e1fda..37ae5089ae 100644
--- a/tests/model_forms/tests.py
+++ b/tests/model_forms/tests.py
@@ -1840,12 +1840,12 @@ class ModelOneToOneFieldTests(TestCase):
author = Author.objects.create(publication=publication, full_name='John Doe')
form = AuthorForm({'publication': '', 'full_name': 'John Doe'}, instance=author)
self.assertTrue(form.is_valid())
- self.assertEqual(form.cleaned_data['publication'], None)
+ self.assertIsNone(form.cleaned_data['publication'])
author = form.save()
# author object returned from form still retains original publication object
# that's why we need to retrieve it from database again
new_author = Author.objects.get(pk=author.pk)
- self.assertEqual(new_author.publication, None)
+ self.assertIsNone(new_author.publication)
def test_assignment_of_none_null_false(self):
class AuthorForm(forms.ModelForm):
@@ -1867,8 +1867,8 @@ class FileAndImageFieldTests(TestCase):
of the value of ``initial``.
"""
f = forms.FileField(required=False)
- self.assertEqual(f.clean(False), False)
- self.assertEqual(f.clean(False, 'initial'), False)
+ self.assertIs(f.clean(False), False)
+ self.assertIs(f.clean(False, 'initial'), False)
def test_clean_false_required(self):
"""
@@ -1902,7 +1902,7 @@ class FileAndImageFieldTests(TestCase):
self.assertIn('myfile-clear', six.text_type(form))
form = DocumentForm(instance=doc, data={'myfile-clear': 'true'})
doc = form.save(commit=False)
- self.assertEqual(bool(doc.myfile), False)
+ self.assertFalse(doc.myfile)
def test_clear_and_file_contradiction(self):
"""
@@ -2175,8 +2175,8 @@ class FileAndImageFieldTests(TestCase):
self.assertTrue(f.is_valid())
instance = f.save()
self.assertEqual(instance.image.name, expected_null_imagefield_repr)
- self.assertEqual(instance.width, None)
- self.assertEqual(instance.height, None)
+ self.assertIsNone(instance.width)
+ self.assertIsNone(instance.height)
f = OptionalImageFileForm(
data={'description': 'And a final one'},