Commits

Carl Meyer committed f3f72d4

Convert failUnless assertions to assertTrue.

Comments (0)

Files changed (1)

         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))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.