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:19:18 -0400
commit4f336f66523001b009ab038b10848508fd208b3b (patch)
tree47474fb588013f1770246455ef7aa1a4163a1edb /tests/model_forms
parentea34426ae789d31b036f58c8fd59ce299649e91e (diff)
Fixed #26747 -- Used more specific assertions in the Django test suite.
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 297ccaae3d..74ea1ad434 100644
--- a/tests/model_forms/tests.py
+++ b/tests/model_forms/tests.py
@@ -1877,12 +1877,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):
@@ -1904,8 +1904,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):
"""
@@ -1939,7 +1939,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):
"""
@@ -2212,8 +2212,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'},