Ticket #19667: 19667.diff

File 19667.diff, 918 bytes (added by ramiro, 2 years ago)

Patch for i18n tests with test case that doesn't fail

  • tests/i18n/tests.py

    diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py
    index d26a201..3f0d044 100644
    a b class TranslationTests(TestCase): 
    338338            rendered = t.render(Context({'person': 'James'}))
    339339            self.assertEqual(rendered, 'My other name is James.')
    340340
     341    def test_ticket19667(self):
     342        # Use a locale with a plural forms formula different from English: Arabic
     343        # nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5
     344        with translation.override('ar'):
     345            t = Template('{% load i18n %}{% blocktrans count nb_users=5 %}{{ nb_users }} user{% plural %}{{ nb_users }} users{% endblocktrans %}')
     346            rendered = t.render(Context())
     347            self.assertEqual(rendered, '5 users')
    341348
    342349@override_settings(USE_L10N=True)
    343350class FormattingTests(TestCase):
Back to Top