From afd040d4d3a06fe92e3080870b2ff2095ce86a75 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 3 Mar 2011 15:04:39 +0000 Subject: 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 --- tests/regressiontests/forms/localflavor/fi.py | 2 +- tests/regressiontests/forms/localflavor/us.py | 2 +- tests/regressiontests/forms/tests/formsets.py | 8 ++++---- tests/regressiontests/forms/tests/models.py | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'tests/regressiontests/forms') 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): ''' - 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): ''' - 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(), """

@@ -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], -- cgit v1.3