diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2011-03-03 15:04:39 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2011-03-03 15:04:39 +0000 |
| commit | afd040d4d3a06fe92e3080870b2ff2095ce86a75 (patch) | |
| tree | bda969614999a3fcfbf1466caa0d75e512dd1374 /tests/regressiontests/forms | |
| parent | b7c41c1fbb2d45634dde5f7a450ba1a5aea5a8af (diff) | |
Updated test assertions that have been deprecated by the move to unittest2. In summary, this means:
assert_ -> assertTrue
assertEquals -> assertEqual
failUnless -> assertTrue
For full details, see http://www.voidspace.org.uk/python/articles/unittest2.shtml#deprecations
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15728 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests/regressiontests/forms')
| -rw-r--r-- | tests/regressiontests/forms/localflavor/fi.py | 2 | ||||
| -rw-r--r-- | tests/regressiontests/forms/localflavor/us.py | 2 | ||||
| -rw-r--r-- | tests/regressiontests/forms/tests/formsets.py | 8 | ||||
| -rw-r--r-- | tests/regressiontests/forms/tests/models.py | 8 |
4 files changed, 10 insertions, 10 deletions
diff --git a/tests/regressiontests/forms/localflavor/fi.py b/tests/regressiontests/forms/localflavor/fi.py index 161eb1743b..3ad95e6148 100644 --- a/tests/regressiontests/forms/localflavor/fi.py +++ b/tests/regressiontests/forms/localflavor/fi.py @@ -351,7 +351,7 @@ class FILocalFlavorTests(LocalFlavorTestCase): <option value="ahtari">\xc4ht\xe4ri</option> <option value="aanekoski">\xc4\xe4nekoski</option> </select>''' - self.assertEquals(f.render('municipalities', 'turku'), out) + self.assertEqual(f.render('municipalities', 'turku'), out) def test_FIZipCodeField(self): error_format = [u'Enter a zip code in the format XXXXX.'] diff --git a/tests/regressiontests/forms/localflavor/us.py b/tests/regressiontests/forms/localflavor/us.py index cde97c8743..8924f0b2da 100644 --- a/tests/regressiontests/forms/localflavor/us.py +++ b/tests/regressiontests/forms/localflavor/us.py @@ -68,7 +68,7 @@ class USLocalFlavorTests(LocalFlavorTestCase): <option value="WI">Wisconsin</option> <option value="WY">Wyoming</option> </select>''' - self.assertEquals(f.render('state', 'IL'), out) + self.assertEqual(f.render('state', 'IL'), out) def test_USZipCodeField(self): error_format = [u'Enter a zip code in the format XXXXX or XXXXX-XXXX.'] diff --git a/tests/regressiontests/forms/tests/formsets.py b/tests/regressiontests/forms/tests/formsets.py index fd854ecaba..4451fc76b1 100644 --- a/tests/regressiontests/forms/tests/formsets.py +++ b/tests/regressiontests/forms/tests/formsets.py @@ -856,13 +856,13 @@ class TestIsBoundBehavior(TestCase): 'form-INITIAL_FORMS': u'0', } formset = ArticleFormSet(data) - self.assertEquals(0, formset.initial_form_count()) - self.assertEquals(1, formset.total_form_count()) + self.assertEqual(0, formset.initial_form_count()) + self.assertEqual(1, formset.total_form_count()) self.assertTrue(formset.is_bound) self.assertTrue(formset.forms[0].is_bound) self.assertTrue(formset.is_valid()) self.assertTrue(formset.forms[0].is_valid()) - self.assertEquals([{}], formset.cleaned_data) + self.assertEqual([{}], formset.cleaned_data) def test_form_errors_are_cought_by_formset(self): @@ -876,7 +876,7 @@ class TestIsBoundBehavior(TestCase): } formset = ArticleFormSet(data) self.assertFalse(formset.is_valid()) - self.assertEquals([{}, {'pub_date': [u'This field is required.']}], formset.errors) + self.assertEqual([{}, {'pub_date': [u'This field is required.']}], formset.errors) def test_empty_forms_are_unbound(self): data = { diff --git a/tests/regressiontests/forms/tests/models.py b/tests/regressiontests/forms/tests/models.py index cfdd4f4bfc..3f548df982 100644 --- a/tests/regressiontests/forms/tests/models.py +++ b/tests/regressiontests/forms/tests/models.py @@ -33,15 +33,15 @@ class ModelFormCallableModelDefault(TestCase): option = ChoiceOptionModel.objects.create(name='default') choices = list(ChoiceFieldForm().fields['choice'].choices) - self.assertEquals(len(choices), 1) - self.assertEquals(choices[0], (option.pk, unicode(option))) + self.assertEqual(len(choices), 1) + self.assertEqual(choices[0], (option.pk, unicode(option))) def test_callable_initial_value(self): "The initial value for a callable default returning a queryset is the pk (refs #13769)" obj1 = ChoiceOptionModel.objects.create(id=1, name='default') obj2 = ChoiceOptionModel.objects.create(id=2, name='option 2') obj3 = ChoiceOptionModel.objects.create(id=3, name='option 3') - self.assertEquals(ChoiceFieldForm().as_p(), """<p><label for="id_choice">Choice:</label> <select name="choice" id="id_choice"> + self.assertEqual(ChoiceFieldForm().as_p(), """<p><label for="id_choice">Choice:</label> <select name="choice" id="id_choice"> <option value="1" selected="selected">ChoiceOption 1</option> <option value="2">ChoiceOption 2</option> <option value="3">ChoiceOption 3</option> @@ -67,7 +67,7 @@ class ModelFormCallableModelDefault(TestCase): obj1 = ChoiceOptionModel.objects.create(id=1, name='default') obj2 = ChoiceOptionModel.objects.create(id=2, name='option 2') obj3 = ChoiceOptionModel.objects.create(id=3, name='option 3') - self.assertEquals(ChoiceFieldForm(initial={ + self.assertEqual(ChoiceFieldForm(initial={ 'choice': obj2, 'choice_int': obj2, 'multi_choice': [obj2,obj3], |
