# -*- coding: utf-8 -*- # Tests to prevent against recurrences of earlier bugs. regression_tests = r""" It should be possible to re-use attribute dictionaries (#3810) >>> from django.newforms import * >>> extra_attrs = {'class': 'special'} >>> class TestForm(Form): ... f1 = CharField(max_length=10, widget=TextInput(attrs=extra_attrs)) ... f2 = CharField(widget=TextInput(attrs=extra_attrs)) >>> TestForm(auto_id=False).as_p() u'

F1:

\n

F2:

' ####################### # Tests for form i18n # ####################### There were some problems with form translations in #3600 >>> from django.utils.translation import gettext_lazy, activate, deactivate >>> class SomeForm(Form): ... username = CharField(max_length=10, label=gettext_lazy('Username')) >>> f = SomeForm() >>> print f.as_p()

>>> activate('de') >>> print f.as_p()

>>> deactivate() Unicode decoding problems... >>> GENDERS = (('0', u'En tied\xe4'), ('1', u'Mies'), ('2', u'Nainen')) >>> class SomeForm(Form): ... somechoice = ChoiceField(choices=GENDERS, widget=RadioSelect()) >>> f = SomeForm() >>> f.as_p() u'

' ####################### # Miscellaneous Tests # ####################### There once was a problem with Form fields called "data". Let's make sure that doesn't come back. >>> class DataForm(Form): ... data = CharField(max_length=10) >>> f = DataForm({'data': 'xyzzy'}) >>> f.is_valid() True >>> f.cleaned_data {'data': u'xyzzy'} """