Skip to content

Commit

Permalink
Add more tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
thefunny42 committed Oct 22, 2018
1 parent 80f8c1e commit 9bb00a4
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/zope/i18n/tests/test_plurals.py
Expand Up @@ -41,7 +41,7 @@ def _getTranslationDomain(self, locale, variant="default"):
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(
Expand All @@ -57,6 +57,25 @@ def test_defaults(self):
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')
Expand Down

0 comments on commit 9bb00a4

Please sign in to comment.