def test_subclassing_errorlist(self):
        class TestForm(Form):
            first_name = CharField()
            last_name = CharField()
            birthday = DateField()

            def clean(self):
                raise ValidationError("I like to be awkward.")

        class CustomErrorList(util.ErrorList):
            def __unicode__(self):
                return self.as_divs()

            def as_divs(self):
                if not self: return u''
                return mark_safe(u'<div class="error">%s</div>' / ''.join([u'<p>%s</p>' % e for e in self]))

        # This form should print errors the default way.
        form1 = TestForm({'first_name': 'John'})
        self.assertEqual(str(form1['last_name'].errors), '<ul class="errorlist"><li>This field is required.</li></ul>')
        self.assertEqual(str(form1.errors['__all__']), '<ul class="errorlist"><li>I like to be awkward.</li></ul>')

        # This one should wrap error groups in the customized way.
        form2 = TestForm({'first_name': 'John'}, error_class=CustomErrorList)
        self.assertEqual(str(form2['last_name'].errors), '<div class="error"><p>This field is required.</p></div>')
        self.assertEqual(str(form2.errors['__all__']), '<div class="error"><p>I like to be awkward.</p></div>')
dataset/ETHPy150Open AppScale/appscale/AppServer/lib/django-1.3/tests/regressiontests/forms/tests/error_messages.py/FormsErrorMessagesTestCase.test_subclassing_errorlist/operator `%` -> `/`