Code

Ticket #3600: newforms_translation_fix_tests.patch

File newforms_translation_fix_tests.patch, 955 bytes (added by akaihola, 7 years ago)

Test which fails before the above patch and succeeds with it

  • tests/regressiontests/forms/tests.py

     
    35563556>>> f.clean('') 
    35573557u'' 
    35583558 
     3559 
     3560####################### 
     3561# Tests for form i18n # 
     3562####################### 
     3563 
     3564>>> from django.utils.translation import gettext_lazy, activate 
     3565>>> class SomeForm(Form): 
     3566...     username = CharField(max_length=10, label=gettext_lazy('Username')) 
     3567>>> f = SomeForm() 
     3568>>> print f.as_p() 
     3569<p><label for="id_username">Username:</label> <input id="id_username" type="text" name="username" maxlength="10" /></p> 
     3570>>> activate('de') 
     3571>>> print f.as_p() 
     3572<p><label for="id_username">Benutzername:</label> <input id="id_username" type="text" name="username" maxlength="10" /></p> 
     3573 
     3574 
    35593575################################# 
    35603576# Tests of underlying functions # 
    35613577#################################