summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2014-08-30 18:48:55 +0200
committerClaude Paroz <claude@2xlibre.net>2014-08-30 18:51:52 +0200
commitd839c756645b5091d55f67bbc4ff10718ff61a6b (patch)
treea3ce61c235aa9cd70edcc126f282b8c3a38cb1cd /tests
parent3297f9e1ad97da1e63ca827239663d6b33949037 (diff)
[1.7.x] Fixed #22820 -- Treated int and long types alike in lazy_number
Thanks kwist for the report and the initial patch. Backport of 5021421799 from master.
Diffstat (limited to 'tests')
-rw-r--r--tests/i18n/tests.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py
index 9edcec4774..35391506e5 100644
--- a/tests/i18n/tests.py
+++ b/tests/i18n/tests.py
@@ -154,6 +154,17 @@ class TranslationTests(TestCase):
with six.assertRaisesRegex(self, KeyError, 'Your dictionary lacks key.*'):
complex_context_deferred % {'name': 'Jim'}
+ @skipUnless(six.PY2, "PY3 doesn't distinct int and long types")
+ def test_ungettext_lazy_long(self):
+ """
+ Regression test for #22820: int and long should be treated alike in ungettext_lazy.
+ """
+ result = ungettext_lazy('%(name)s has %(num)d good result', '%(name)s has %(num)d good results', 4)
+ self.assertEqual(result % {'name': 'Joe', 'num': 4}, "Joe has 4 good results")
+ # Now with a long
+ result = ungettext_lazy('%(name)s has %(num)d good result', '%(name)s has %(num)d good results', long(4))
+ self.assertEqual(result % {'name': 'Joe', 'num': 4}, "Joe has 4 good results")
+
@override_settings(LOCALE_PATHS=extended_locale_paths)
def test_pgettext(self):
trans_real._active = local()