summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Viollon <sviollon@minddistrict.com>2018-10-22 10:35:27 +0200
committerSylvain Viollon <sviollon@minddistrict.com>2018-10-22 10:35:27 +0200
commit9bb00a4a1298553e0fd8fba3657bc2e3eaa1b6e3 (patch)
tree52c864c6450b965278e8abfb5188b4d3de3ddb7a
parent80f8c1e9ff2a48b1142fe5741e90f8fcf35fc0a4 (diff)
downloadzope-i18n-9bb00a4a1298553e0fd8fba3657bc2e3eaa1b6e3.tar.gz
Add more tests.
-rw-r--r--src/zope/i18n/tests/test_plurals.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/zope/i18n/tests/test_plurals.py b/src/zope/i18n/tests/test_plurals.py
index 12b46cc..28d6b3a 100644
--- a/src/zope/i18n/tests/test_plurals.py
+++ b/src/zope/i18n/tests/test_plurals.py
@@ -41,7 +41,7 @@ class TestPlurals(unittest.TestCase):
domain.addCatalog(catalog)
return domain
- def test_defaults(self):
+ def test_translate_without_defaults(self):
domain = self._getTranslationDomain('en')
zope.component.provideUtility(domain, ITranslationDomain, 'default')
self.assertEqual(
@@ -57,6 +57,25 @@ class TestPlurals(unittest.TestCase):
msgid_plural='%d apples', number=2),
'2 apples')
+ def test_translate_with_defaults(self):
+ domain = self._getTranslationDomain('en')
+ zope.component.provideUtility(domain, ITranslationDomain, 'default')
+ self.assertEqual(
+ translate('One apple', domain='default',
+ msgid_plural='%d apples', number=0,
+ default='One fruit', default_plural='%d fruits'),
+ '0 fruits')
+ self.assertEqual(
+ translate('One apple', domain='default',
+ msgid_plural='%d apples', number=1,
+ default='One fruit', default_plural='%d fruits'),
+ 'One fruit')
+ self.assertEqual(
+ translate('One apple', domain='default',
+ msgid_plural='%d apples', number=2,
+ default='One fruit', default_plural='%d fruits'),
+ '2 fruits')
+
def test_missing_queryPluralMessage(self):
catalog = self._getMessageCatalog('en')
self.assertEqual(catalog.language, 'en')