[Zope-Checkins] CVS: Zope3/lib/python/Zope/I18n/tests - testNegotiator.py:1.3
Barry Warsaw
barry@wooz.org
Wed, 12 Jun 2002 11:59:41 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/I18n/tests
In directory cvs.zope.org:/tmp/cvs-serv18257/lib/python/Zope/I18n/tests
Modified Files:
testNegotiator.py
Log Message:
IUserPreferedLanguages -> IUserPreferredLanguages
getLanguages() -> getPreferredLanguages()
Also, a little bit of code cleanup.
=== Zope3/lib/python/Zope/I18n/tests/testNegotiator.py 1.2 => 1.3 ===
from Zope.I18n.Negotiator import Negotiator
-from Zope.I18n.IUserPreferedLanguages import IUserPreferedLanguages
+from Zope.I18n.IUserPreferredLanguages import IUserPreferredLanguages
from Zope.ComponentArchitecture.tests.PlacelessSetup import PlacelessSetup
class Env:
-
- __implements__ = IUserPreferedLanguages
+ __implements__ = IUserPreferredLanguages
def __init__(self, langs=()):
self.langs = langs
- def getLanguages(self):
+ def getPreferredLanguages(self):
return self.langs
class Test(PlacelessSetup, unittest.TestCase):
-
def setUp(self):
PlacelessSetup.setUp(self)
- self.Negotiator= Negotiator()
+ self.Negotiator = Negotiator()
def test1(self):
_cases = (
- ( ('en','de'), ('en','de','fr'), 'en'),
- ( ('en'), ('it','de','fr'), None)
- )
+ (('en','de'), ('en','de','fr'), 'en'),
+ (('en'), ('it','de','fr'), None)
+ )
for user_pref_langs, obj_langs, expected in _cases:
-
env = Env(user_pref_langs)
-
- self.assertEqual( self.Negotiator.getLanguage( obj_langs, env),
- expected)
-
-
+ self.assertEqual(self.Negotiator.getLanguage(obj_langs, env),
+ expected)
def test_suite():
- loader=unittest.TestLoader()
+ loader = unittest.TestLoader()
return loader.loadTestsFromTestCase(Test)
-if __name__=='__main__':
+
+if __name__ == '__main__':
unittest.TextTestRunner().run(test_suite())