Code

Ticket #19667: 19667.diff

File 19667.diff, 918 bytes (added by ramiro, 17 months ago)

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

Line 
1diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py
2index d26a201..3f0d044 100644
3--- a/tests/i18n/tests.py
4+++ b/tests/i18n/tests.py
5@@ -338,6 +338,13 @@ class TranslationTests(TestCase):
6             rendered = t.render(Context({'person': 'James'}))
7             self.assertEqual(rendered, 'My other name is James.')
8 
9+    def test_ticket19667(self):
10+        # Use a locale with a plural forms formula different from English: Arabic
11+        # 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
12+        with translation.override('ar'):
13+            t = Template('{% load i18n %}{% blocktrans count nb_users=5 %}{{ nb_users }} user{% plural %}{{ nb_users }} users{% endblocktrans %}')
14+            rendered = t.render(Context())
15+            self.assertEqual(rendered, '5 users')
16 
17 @override_settings(USE_L10N=True)
18 class FormattingTests(TestCase):