Carl Meyer avatar Carl Meyer committed 964c659

Convert assertEquals assertions to assertEqual.

Comments (0)

Files changed (1)

         for form_class, targets in self.fieldset_target_data.items():
             form = form_class()
             # verify len(form.fieldsets) tells us the truth
-            self.assertEquals(len(form.fieldsets), len(targets))
+            self.assertEqual(len(form.fieldsets), len(targets))
             for i, fs in enumerate(form.fieldsets):
                 target_data = targets[i]
                 # verify fieldset contains correct fields
-                self.assertEquals([f.name for f in fs],
+                self.assertEqual([f.name for f in fs],
                                   target_data[0])
                 # verify fieldset has correct attributes
                 for attr, val in target_data[1].items():
-                    self.assertEquals(getattr(fs, attr), val)
+                    self.assertEqual(getattr(fs, attr), val)
 
     def test_fieldset_errors(self):
         """
         """
         form = ApplicationForm(data={'name': 'John Doe',
                                      'reference': 'Jane Doe'})
-        self.assertEquals([fs.errors for fs in form.fieldsets],
+        self.assertEqual([fs.errors for fs in form.fieldsets],
                           [{'position': [u'This field is required.']}, {}])
 
     def test_iterate_fields(self):
 
         """
         form = ApplicationForm()
-        self.assertEquals([field.name for field in form],
+        self.assertEqual([field.name for field in form],
                           ['name', 'position', 'reference'])
 
     def test_getitem_fields(self):
         """
         form = ApplicationForm()
         fieldset = form.fieldsets['main']
-        self.assertEquals(fieldset.name, 'main')
-        self.assertEquals(len(fieldset.boundfields), 2)
+        self.assertEqual(fieldset.name, 'main')
+        self.assertEqual(len(fieldset.boundfields), 2)
 
     def test_row_attrs_by_name(self):
         """
 
         """
         form = HoneypotForm()
-        self.assertEquals(form['honeypot'].row_attrs,
+        self.assertEqual(form['honeypot'].row_attrs,
                           u' style="display: none" class="required"')
 
     def test_row_attrs_by_iteration(self):
         """
         form = HoneypotForm()
         honeypot = [field for field in form if field.name=='honeypot'][0]
-        self.assertEquals(honeypot.row_attrs,
+        self.assertEqual(honeypot.row_attrs,
                           u' style="display: none" class="required"')
 
     def test_row_attrs_by_fieldset_iteration(self):
         form = HoneypotForm()
         fieldset = [fs for fs in form.fieldsets][0]
         honeypot = [field for field in fieldset if field.name=='honeypot'][0]
-        self.assertEquals(honeypot.row_attrs,
+        self.assertEqual(honeypot.row_attrs,
                           u' style="display: none" class="required"')
 
     def test_row_attrs_error_class(self):
         populated with the fields present in a fieldsets definition.
 
         """
-        self.assertEquals(PartialPersonForm._meta.fields, ['name'])
+        self.assertEqual(PartialPersonForm._meta.fields, ['name'])
 
     def test_modelform_manual_fields(self):
         """
         populated if it's set manually.
 
         """
-        self.assertEquals(ManualPartialPersonForm._meta.fields, ['name', 'age'])
+        self.assertEqual(ManualPartialPersonForm._meta.fields, ['name', 'age'])
 
     def test_modelform_fields(self):
         """
         populated if ``exclude`` is set manually.
 
         """
-        self.assertEquals(ExcludePartialPersonForm._meta.fields, None)
+        self.assertEqual(ExcludePartialPersonForm._meta.fields, None)
 
 
 class BoringForm(forms.Form):
         form = BoringForm()
         tpl = template.Template('{% load form_utils_tags %}{{ form|render }}')
         html = tpl.render(template.Context({'form': form}))
-        self.assertEquals([l.strip() for l in html.splitlines() if l.strip()],
+        self.assertEqual([l.strip() for l in html.splitlines() if l.strip()],
                           self.boring_form_html)
 
     betterform_html = [
         form = ApplicationForm()
         tpl = template.Template('{% load form_utils_tags %}{{ form|render }}')
         html = tpl.render(template.Context({'form': form}))
-        self.assertEquals([l.strip() for l in html.splitlines() if l.strip()],
+        self.assertEqual([l.strip() for l in html.splitlines() if l.strip()],
                           self.betterform_html)
 
 
         """
         widget = ImageWidget()
         html = widget.render('fieldname', FieldFile(None, FileField(), 'something.txt'))
-        self.assertEquals(html, '<input type="file" name="fieldname" value="something.txt" />')
+        self.assertEqual(html, '<input type="file" name="fieldname" value="something.txt" />')
 
     def test_custom_template(self):
         """
         """
         widget = ClearableFileInput()
         html = widget.render('fieldname', 'tiny.png')
-        self.assertEquals(html,
+        self.assertEqual(html,
                           '<input type="file" name="fieldname_0" />'
                           ' Clear: '
                           '<input type="checkbox" name="fieldname_1" />')
         """
         widget = ClearableFileInput(template='Clear: %(checkbox)s %(input)s')
         html = widget.render('fieldname', ImageFieldFile(None, ImageField(), 'tiny.png'))
-        self.assertEquals(html,
+        self.assertEqual(html,
                           'Clear: '
                           '<input type="checkbox" name="fieldname_1" /> '
                           '<input type="file" name="fieldname_0" />')
             template = 'Clear: %(checkbox)s %(input)s'
         widget = ReversedClearableFileInput()
         html = widget.render('fieldname', 'tiny.png')
-        self.assertEquals(html,
+        self.assertEqual(html,
                           'Clear: '
                           '<input type="checkbox" name="fieldname_1" /> '
                           '<input type="file" name="fieldname_0" />')
         class TestForm(forms.Form):
             f = ClearableFileField()
         form = TestForm(files={'f_0': self.upload})
-        self.assertEquals(unicode(form['f']),
+        self.assertEqual(unicode(form['f']),
                           u'<input type="file" name="f_0" id="id_f_0" />'
                           u' Clear: <input type="checkbox" name="f_1" id="id_f_1" />')
 
         """
         field = ClearableFileField()
         result = field.clean([self.upload, '0'])
-        self.assertEquals(result, self.upload)
+        self.assertEqual(result, self.upload)
 
     def test_cleared(self):
         """
         doc._meta.get_field('myfile').save_form_data(doc, result)
         doc.save()
         doc = Document.objects.get(pk=doc.pk)
-        self.assertEquals(doc.myfile, '')
+        self.assertEqual(doc.myfile, '')
 
     def test_cleared_but_file_given(self):
         """
         """
         field = ClearableFileField()
         result = field.clean([self.upload, '1'])
-        self.assertEquals(result, self.upload)
+        self.assertEqual(result, self.upload)
 
     def test_custom_file_field(self):
         """
         """
         file_field = forms.ImageField(required=False)
         field = ClearableFileField(file_field=file_field)
-        self.failIf(field.required)
+        self.assertFalse(field.required)
 
     def test_custom_file_field_widget_used(self):
         """
         """
         tpl = 'Clear: %(checkbox)s %(input)s'
         field = ClearableFileField(template=tpl)
-        self.assertEquals(field.widget.template, tpl)
+        self.assertEqual(field.widget.template, tpl)
 
     def test_custom_widget_by_subclassing(self):
         """
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.