[Zope-Checkins] CVS: Zope3/lib/python/Zope/I18n/tests - testIReadMessageCatalog.py:1.3 testIReadTranslationService.py:1.4
Florent Guillaume
fg@nuxeo.com
Sun, 6 Oct 2002 13:44:40 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/I18n/tests
In directory cvs.zope.org:/tmp/cvs-serv14802/tests
Modified Files:
testIReadMessageCatalog.py testIReadTranslationService.py
Log Message:
Modified translation service and message catalog interface to be able to
return None when no translation is available.
=== Zope3/lib/python/Zope/I18n/tests/testIReadMessageCatalog.py 1.2 => 1.3 ===
--- Zope3/lib/python/Zope/I18n/tests/testIReadMessageCatalog.py:1.2 Mon Jul 1 13:45:50 2002
+++ Zope3/lib/python/Zope/I18n/tests/testIReadMessageCatalog.py Sun Oct 6 13:44:39 2002
@@ -45,7 +45,7 @@
def testQueryMessage(self):
catalog = self._catalog
self.assertEqual(catalog.queryMessage('short_greeting'), 'Hello!')
- self.assertEqual(catalog.queryMessage('foo'), 'foo')
+ self.assertEqual(catalog.queryMessage('foo'), None)
self.assertEqual(catalog.queryMessage('foo', 'bar'), 'bar')
=== Zope3/lib/python/Zope/I18n/tests/testIReadTranslationService.py 1.3 => 1.4 ===
--- Zope3/lib/python/Zope/I18n/tests/testIReadTranslationService.py:1.3 Mon Jul 1 13:45:50 2002
+++ Zope3/lib/python/Zope/I18n/tests/testIReadTranslationService.py Sun Oct 6 13:44:39 2002
@@ -112,6 +112,13 @@
# context argument
context = Environment(('de', 'en'))
eq(translate('short_greeting', context=context), 'Hallo!')
-
+
+ def testNoTranslation(self):
+ translate = self._service.translate
+ eq = self.assertEqual
+ # Test that an unknown message id returns None as a translation
+ eq(translate('default', 'glorp_smurf_hmpf', target_language='en'),
+ None)
+
def test_suite():
return unittest.TestSuite() # Deliberatly empty