Commits

Carl Meyer  committed f3f72d4

Convert failUnless assertions to assertTrue.

  • Participants
  • Parent commits 0ead8e9

Comments (0)

Files changed (1)

File tests/tests.py

         html = widget.render('fieldname', ImageFieldFile(None, ImageField(), 'tiny.png'))
         # test only this much of the html, because the remainder will
         # vary depending on whether we have sorl-thumbnail
-        self.failUnless(html.startswith(
+        self.assertTrue(html.startswith(
                 '<input type="file" name="fieldname" value="tiny.png" />'
-                '<br /><img src="/media/tiny'))
+                '<br /><img src="/media/tiny'), html)
 
     def test_render_nonimage(self):
         """
         widget = ImageWidget(template='<div>%(image)s</div>'
                              '<div>%(input)s</div>')
         html = widget.render('fieldname', ImageFieldFile(None, ImageField(), 'tiny.png'))
-        self.failUnless(html.startswith('<div><img src="/media/tiny'))
+        self.assertTrue(html.startswith('<div><img src="/media/tiny'))
 
 
 class ClearableFileInputTests(TestCase):
         """
         widget = ClearableFileInput(file_widget=ImageWidget())
         html = widget.render('fieldname', ImageFieldFile(None, ImageField(), 'tiny.png'))
-        self.failUnless(html.startswith(
+        self.assertTrue(html.startswith(
                 '<input type="file" name="fieldname_0" value="tiny.png" />'
                 '<br /><img src="/media/tiny'))
 
             default_file_widget_class = ImageWidget
         widget = ClearableImageWidget()
         html = widget.render('fieldname', ImageFieldFile(None, ImageField(), 'tiny.png'))
-        self.failUnless(html.startswith(
+        self.assertTrue(html.startswith(
                 '<input type="file" name="fieldname_0" value="tiny.png" />'
                 '<br /><img src="/media/tiny'))
 
         """
         file_field = forms.ImageField()
         field = ClearableFileField(file_field=file_field)
-        self.failUnless(field.fields[0] is file_field)
+        self.assertTrue(field.fields[0] is file_field)
 
     def test_custom_file_field_required(self):
         """
         widget = ImageWidget()
         file_field = forms.ImageField(widget=widget)
         field = ClearableFileField(file_field=file_field)
-        self.failUnless(field.fields[0].widget is widget)
+        self.assertTrue(field.fields[0].widget is widget)
 
     def test_clearable_image_field(self):
         """
 
         """
         field = ClearableImageField()
-        self.failUnless(isinstance(field.fields[0], forms.ImageField))
+        self.assertTrue(isinstance(field.fields[0], forms.ImageField))
 
     def test_custom_template(self):
         """
         class ClearableImageWidgetField(ClearableFileField):
             widget = ClearableImageWidget
         field = ClearableImageWidgetField()
-        self.failUnless(isinstance(field.widget, ClearableImageWidget))
+        self.assertTrue(isinstance(field.widget, ClearableImageWidget))