[Zope3-checkins] CVS: Zope3/src/zope/i18n/tests - test_gettextmessagecatalog.py:1.1.2.3 test_globaltranslationservice.py:1.1.2.3 test_ireadmessagecatalog.py:1.1.2.2 test_ireadtranslationservice.py:1.1.2.4 test_isynctranslationservice.py:1.1.2.2 test_iwritemessagecatalog.py:1.1.2.2 test_iwritetranslationservice.py:1.1.2.4 test_negotiator.py:1.1.2.2 test_simpletranslationservice.py:1.1.2.2 testi18nawareobject.py:1.1.2.3 testii18naware.py:1.1.2.2
Tim Peters
tim.one@comcast.net
Tue, 24 Dec 2002 21:21:38 -0500
Update of /cvs-repository/Zope3/src/zope/i18n/tests
In directory cvs.zope.org:/tmp/cvs-serv19240/src/zope/i18n/tests
Modified Files:
Tag: NameGeddon-branch
test_gettextmessagecatalog.py test_globaltranslationservice.py
test_ireadmessagecatalog.py test_ireadtranslationservice.py
test_isynctranslationservice.py test_iwritemessagecatalog.py
test_iwritetranslationservice.py test_negotiator.py
test_simpletranslationservice.py testi18nawareobject.py
testii18naware.py
Log Message:
Whitespace normalization, via Python's Tools/scripts/reindent.py. The
files are fixed-points of that script now. Fixed a few cases where
code relied on significant trailing whitespace (ouch).
=== Zope3/src/zope/i18n/tests/test_gettextmessagecatalog.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/i18n/tests/test_gettextmessagecatalog.py:1.1.2.2 Mon Dec 23 16:28:56 2002
+++ Zope3/src/zope/i18n/tests/test_gettextmessagecatalog.py Tue Dec 24 21:21:07 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""Test a gettext implementation of a Message Catalog.
@@ -30,7 +30,7 @@
catalog = GettextMessageCatalog('en', 'default', self._path)
return catalog
-
+
def _getUniqueIndentifier(self):
return self._path
=== Zope3/src/zope/i18n/tests/test_globaltranslationservice.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/i18n/tests/test_globaltranslationservice.py:1.1.2.2 Mon Dec 23 16:28:56 2002
+++ Zope3/src/zope/i18n/tests/test_globaltranslationservice.py Tue Dec 24 21:21:07 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""This module tests the regular persistent Translation Service.
@@ -17,7 +17,7 @@
"""
import unittest, sys, os
from zope.i18n.globaltranslationservice import GlobalTranslationService
-from zope.i18n.gettextmessagecatalog import GettextMessageCatalog
+from zope.i18n.gettextmessagecatalog import GettextMessageCatalog
from zope.i18n.tests.test_ireadtranslationservice import TestIReadTranslationService, \
Environment
@@ -29,7 +29,7 @@
class TestGlobalTranslationService(TestIReadTranslationService):
def _getTranslationService(self):
- service = GlobalTranslationService('default')
+ service = GlobalTranslationService('default')
path = testdir()
en_catalog = GettextMessageCatalog('en', 'default',
os.path.join(path, 'en-default.mo'))
@@ -57,7 +57,7 @@
'short_greeting')
# Test that at least one of context or target_language is given
raises(TypeError, translate, 'short_greeting', context=None)
-
+
def testSimpleFallbackTranslation(self):
translate = self._service.translate
raises = self.assertRaises
=== Zope3/src/zope/i18n/tests/test_ireadmessagecatalog.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/i18n/tests/test_ireadmessagecatalog.py:1.1.2.1 Mon Dec 23 14:32:51 2002
+++ Zope3/src/zope/i18n/tests/test_ireadmessagecatalog.py Tue Dec 24 21:21:07 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""This is an 'abstract' test for the IMessageCatalog interface.
@@ -26,41 +26,41 @@
# This should be overwritten by every class that inherits this test
def _getMessageCatalog(self):
pass
-
+
def _getUniqueIndentifier(self):
pass
def setUp(self):
- self._catalog = self._getMessageCatalog()
+ self._catalog = self._getMessageCatalog()
assert verifyObject(IReadMessageCatalog, self._catalog)
def testGetMessage(self):
- catalog = self._catalog
+ catalog = self._catalog
self.assertEqual(catalog.getMessage('short_greeting'), 'Hello!')
self.assertRaises(KeyError, catalog.getMessage, 'foo')
-
+
def testQueryMessage(self):
- catalog = self._catalog
+ catalog = self._catalog
self.assertEqual(catalog.queryMessage('short_greeting'), 'Hello!')
self.assertEqual(catalog.queryMessage('foo'), None)
self.assertEqual(catalog.queryMessage('foo', 'bar'), 'bar')
-
+
def testGetLanguage(self):
- catalog = self._catalog
+ catalog = self._catalog
self.assertEqual(catalog.getLanguage(), 'en')
def testGetDomain(self):
- catalog = self._catalog
+ catalog = self._catalog
self.assertEqual(catalog.getDomain(), 'default')
def testGetIdentifier(self):
- catalog = self._catalog
+ catalog = self._catalog
self.assertEqual(catalog.getIdentifier(), self._getUniqueIndentifier())
=== Zope3/src/zope/i18n/tests/test_ireadtranslationservice.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/i18n/tests/test_ireadtranslationservice.py:1.1.2.3 Tue Dec 24 07:51:26 2002
+++ Zope3/src/zope/i18n/tests/test_ireadtranslationservice.py Tue Dec 24 21:21:07 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""This is an 'abstract' test for the ITranslationService interface.
@@ -46,13 +46,13 @@
# This should be overwritten by every clas that inherits this test
def _getTranslationService(self):
pass
-
+
def setUp(self):
PlacelessSetup.setUp(self)
- self._service = self._getTranslationService()
+ self._service = self._getTranslationService()
assert verifyObject(IReadTranslationService, self._service)
# Setup the negotiator service registry entry
- managerHandler('defineService', 'LanguageNegotiation', INegotiator)
+ managerHandler('defineService', 'LanguageNegotiation', INegotiator)
provideService('LanguageNegotiation', negotiator, 'zope.Public')
# I know, I know. This is not part of the interface, but it is implemented
@@ -77,7 +77,7 @@
# Test escaping the $
eq(interp('This is $$name.', mapping), 'This is $$name.')
eq(interp('This is $${name}.', mapping), 'This is $${name}.')
-
+
def testSimpleTranslate(self):
translate = self._service.translate
eq = self.assertEqual
@@ -89,7 +89,7 @@
context = Environment(('de', 'en'))
eq(translate('default', 'short_greeting', context=context),
'Hallo!')
-
+
def testDynamicTranslate(self):
translate = self._service.translate
eq = self.assertEqual
@@ -99,12 +99,12 @@
'Hallo Stephan, wie geht es Dir?')
def testGetDomain(self):
- service = self._service
+ service = self._service
domain = service.getDomain('default')
self.assertEqual(verifyObject(IDomain, domain), 1)
def testDomainTranslate(self):
- service = self._service
+ service = self._service
domain = service.getDomain('default')
translate = domain.translate
eq = self.assertEqual
=== Zope3/src/zope/i18n/tests/test_isynctranslationservice.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/i18n/tests/test_isynctranslationservice.py:1.1.2.1 Mon Dec 23 14:32:51 2002
+++ Zope3/src/zope/i18n/tests/test_isynctranslationservice.py Tue Dec 24 21:21:07 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""This is an 'abstract' test for the Synchronization Support interface.
@@ -28,7 +28,7 @@
foreign_messages = [
# Message that is not locally available
{'domain': 'default', 'language': 'en', 'msgid': 'test',
- 'msgstr': 'Test', 'mod_time': 0},
+ 'msgstr': 'Test', 'mod_time': 0},
# This message is newer than the local one.
{'domain': 'default', 'language': 'de', 'msgid': 'short_greeting',
'msgstr': 'Hallo.', 'mod_time': 20},
@@ -50,20 +50,20 @@
# This message is up-to-date.
{'domain': 'default', 'language': 'en', 'msgid': 'greeting',
'msgstr': 'Hello $name, how are you?', 'mod_time': 0},
- # This message is only available locally.
+ # This message is only available locally.
{'domain': 'default', 'language': 'de', 'msgid': 'greeting',
'msgstr': 'Hallo $name, wie geht es Dir?', 'mod_time': 0},
]
-
+
# This should be overwritten by every clas that inherits this test
def _getTranslationService(self):
pass
-
+
def setUp(self):
PlacelessSetup.setUp(self)
- self._service = self._getTranslationService()
+ self._service = self._getTranslationService()
assert verifyObject(ISyncTranslationService, self._service)
@@ -100,9 +100,9 @@
self.foreign_messages[3])
self.assertEqual(service.getMessage('greeting', 'default', 'de'),
None)
-
-
+
+
def test_suite():
return unittest.TestSuite() # Deliberatly empty
=== Zope3/src/zope/i18n/tests/test_iwritemessagecatalog.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/i18n/tests/test_iwritemessagecatalog.py:1.1.2.1 Mon Dec 23 14:32:51 2002
+++ Zope3/src/zope/i18n/tests/test_iwritemessagecatalog.py Tue Dec 24 21:21:07 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""This is an 'abstract' test for the IMessageCatalog interface.
@@ -27,13 +27,13 @@
# This should be overwritten by every class that inherits this test
def _getMessageCatalog(self):
pass
-
+
def _getUniqueIndentifier(self):
pass
def setUp(self):
- self._catalog = self._getMessageCatalog()
+ self._catalog = self._getMessageCatalog()
assert verifyObject(IWriteMessageCatalog, self._catalog)
@@ -45,7 +45,7 @@
'msgid': 'short_greeting',
'msgstr': 'Hello!',
'mod_time': 0})
-
+
def testSetMessage(self):
catalog = self._catalog
@@ -56,15 +56,15 @@
'msgid': 'test',
'msgstr': 'Test',
'mod_time': 1})
- catalog.deleteMessage('test')
-
+ catalog.deleteMessage('test')
+
def testDeleteMessage(self):
catalog = self._catalog
self.assertEqual(catalog.queryMessage('test'), None)
catalog.setMessage('test', 'Test', 1)
self.assertEqual(catalog.queryMessage('test'), 'Test')
- catalog.deleteMessage('test')
+ catalog.deleteMessage('test')
self.assertEqual(catalog.queryMessage('test'), None)
=== Zope3/src/zope/i18n/tests/test_iwritetranslationservice.py 1.1.2.3 => 1.1.2.4 ===
--- Zope3/src/zope/i18n/tests/test_iwritetranslationservice.py:1.1.2.3 Tue Dec 24 07:51:26 2002
+++ Zope3/src/zope/i18n/tests/test_iwritetranslationservice.py Tue Dec 24 21:21:07 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""This is an 'abstract' test for the ITranslationService interface.
@@ -51,17 +51,17 @@
de and en
"""
-
+
def setUp(self):
PlacelessSetup.setUp(self)
- self._service = self._getTranslationService()
+ self._service = self._getTranslationService()
assert verifyObject(ITranslationService, self._service)
managerHandler('defineService', 'Translation',
- ITranslationService)
+ ITranslationService)
provideService('Translation', self._service, 'zope.Public')
# Setup the negotiator service registry entry
- managerHandler('defineService', 'LanguageNegotiation', INegotiator)
+ managerHandler('defineService', 'LanguageNegotiation', INegotiator)
provideService('LanguageNegotiation', negotiator, 'zope.Public')
@@ -77,13 +77,13 @@
d = self._getDomains(service)
self.assertEqual(service.getAllDomains(), d+[])
service.addDomain('test')
- self.assertEqual(service.getAllDomains(), d+['test'])
+ self.assertEqual(service.getAllDomains(), d+['test'])
service.addDomain('test2')
self.assertEqual(service.getAllDomains(), d+['test', 'test2'])
self.assertEqual(service.getAvailableDomains('de'),
d+['test', 'test2'])
service.deleteDomain('test')
- self.assertEqual(service.getAllDomains(), d+['test2'])
+ self.assertEqual(service.getAllDomains(), d+['test2'])
service.deleteDomain('test2')
self.assertEqual(service.getAllDomains(), d+[])
@@ -99,13 +99,13 @@
service.addDomain('test')
langs = self._getLanguages(service)
service.addLanguage('es')
- self.assertEqual(self._getLanguages(service), langs+['es'])
+ self.assertEqual(self._getLanguages(service), langs+['es'])
service.addLanguage('fr')
self.assertEqual(self._getLanguages(service), langs+['es', 'fr'])
self.assertEqual(service.getAvailableLanguages('test'),
langs+['es', 'fr'])
service.deleteLanguage('es')
- self.assertEqual(self._getLanguages(service), langs+['fr'])
+ self.assertEqual(self._getLanguages(service), langs+['fr'])
service.deleteLanguage('fr')
self.assertEqual(self._getLanguages(service), langs)
@@ -152,6 +152,6 @@
self.assertEqual(self._getMessageIds(service, 'test2', 'gre%'),
['greeting3', 'greeting4'])
-
+
def test_suite():
return unittest.TestSuite() # Deliberatly empty
=== Zope3/src/zope/i18n/tests/test_negotiator.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/i18n/tests/test_negotiator.py:1.1.2.1 Mon Dec 23 14:32:51 2002
+++ Zope3/src/zope/i18n/tests/test_negotiator.py Tue Dec 24 21:21:07 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""
@@ -45,7 +45,7 @@
for user_pref_langs, obj_langs, expected in _cases:
env = Env(user_pref_langs)
- self.assertEqual(self.Negotiator.getLanguage(obj_langs, env),
+ self.assertEqual(self.Negotiator.getLanguage(obj_langs, env),
expected)
=== Zope3/src/zope/i18n/tests/test_simpletranslationservice.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/i18n/tests/test_simpletranslationservice.py:1.1.2.1 Mon Dec 23 14:32:51 2002
+++ Zope3/src/zope/i18n/tests/test_simpletranslationservice.py Tue Dec 24 21:21:07 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""This module tests the regular persistent Translation Service.
@@ -28,7 +28,7 @@
('default', 'de', 'short_greeting'): 'Hallo!',
('default', 'en', 'greeting'): 'Hello $name, how are you?',
('default', 'de', 'greeting'): 'Hallo $name, wie geht es Dir?'}
- )
+ )
return service
=== Zope3/src/zope/i18n/tests/testi18nawareobject.py 1.1.2.2 => 1.1.2.3 ===
--- Zope3/src/zope/i18n/tests/testi18nawareobject.py:1.1.2.2 Tue Dec 24 07:51:26 2002
+++ Zope3/src/zope/i18n/tests/testi18nawareobject.py Tue Dec 24 21:21:07 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""This is a test for the II18nAware interface.
=== Zope3/src/zope/i18n/tests/testii18naware.py 1.1.2.1 => 1.1.2.2 ===
--- Zope3/src/zope/i18n/tests/testii18naware.py:1.1.2.1 Mon Dec 23 14:32:51 2002
+++ Zope3/src/zope/i18n/tests/testii18naware.py Tue Dec 24 21:21:07 2002
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
-#
+#
##############################################################################
"""This is a test for the II18nAware interface.
@@ -49,4 +49,3 @@
def test_suite():
return unittest.TestSuite() # Deliberatly empty
-