[Zope3-checkins] CVS: Zope3/src/zope/tal/tests - test_talinterpreter.py:1.3.4.14

Fred L. Drake, Jr. fred at zope.com
Fri Aug 8 17:28:08 EDT 2003


Update of /cvs-repository/Zope3/src/zope/tal/tests
In directory cvs.zope.org:/tmp/cvs-serv28762

Modified Files:
      Tag: srichter-i18n-macro-interaction-branch
	test_talinterpreter.py 
Log Message:
minor cleanup


=== Zope3/src/zope/tal/tests/test_talinterpreter.py 1.3.4.13 => 1.3.4.14 ===
--- Zope3/src/zope/tal/tests/test_talinterpreter.py:1.3.4.13	Fri Aug  8 15:27:43 2003
+++ Zope3/src/zope/tal/tests/test_talinterpreter.py	Fri Aug  8 16:28:04 2003
@@ -61,10 +61,12 @@
 
 class I18NCornerTestCase(TestCaseBase):
 
-    def _check(self, program, expected):
+    def setUp(self):
         self.engine = DummyEngine()
         self.engine.setLocal('foo', MessageID('FoOvAlUe', 'default'))
         self.engine.setLocal('bar', 'BaRvAlUe')
+
+    def _check(self, program, expected):
         result = StringIO()
         self.interpreter = TALInterpreter(program, {}, self.engine,
                                           stream=result)
@@ -138,13 +140,10 @@
         self._check(program,
                     '<div>THIS IS TEXT FOR <span>BARVALUE</span></div>\n')
 
-
     def test_for_correct_msgids(self):
 
         class CollectingTranslationService(DummyTranslationService):
-
-            def __init__(self):
-                self.data = []
+            data = []
 
             def translate(self, msgid, domain=None, mapping=None,
                           context=None, target_language=None, default=None):
@@ -153,20 +152,19 @@
                     self,
                     msgid, domain, mapping, context, target_language, default)
 
-        engine = DummyEngine()
-        engine.setLocal('bar', 'BaRvAlUe')
-        engine.translationService = CollectingTranslationService()
+        xlatsvc = CollectingTranslationService()
+        self.engine.translationService = xlatsvc
         result = StringIO()
         program, macros = self._compile(
             '<div i18n:translate="">This is text for '
             '<span i18n:translate="" tal:content="bar" '
             'i18n:name="bar_name"/>.</div>')
-        self.interpreter = TALInterpreter(program, {}, engine,
+        self.interpreter = TALInterpreter(program, {}, self.engine,
                                           stream=result)
         self.interpreter()
-        self.assert_('BaTvAlUe' in engine.translationService.data)
+        self.assert_('BaTvAlUe' in xlatsvc.data)
         self.assert_('<div>This is text for ${bar_name}.</div>' in
-                     engine.translationService.data)
+                     xlatsvc.data)
         self.assertEqual(
             '<div>THIS IS TEXT FOR <span>BARVALUE</span></div>\n',
             result.getvalue())




More information about the Zope3-Checkins mailing list