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

Stephan Richter srichter at cosmos.phy.tufts.edu
Fri Aug 8 11:41:10 EDT 2003


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

Modified Files:
      Tag: srichter-i18n-macro-interaction-branch
	test_talinterpreter.py 
Log Message:
New bug identified.


=== Zope3/src/zope/tal/tests/test_talinterpreter.py 1.3 => 1.3.4.1 ===
--- Zope3/src/zope/tal/tests/test_talinterpreter.py:1.3	Tue Jul 22 08:37:31 2003
+++ Zope3/src/zope/tal/tests/test_talinterpreter.py	Fri Aug  8 10:41:04 2003
@@ -24,7 +24,7 @@
 from zope.tal.talinterpreter import TALInterpreter
 from zope.tal.dummyengine import DummyEngine
 from zope.tal.tests import utils
-
+from zope.i18n.messageid import MessageID
 
 class TestCaseBase(unittest.TestCase):
 
@@ -59,6 +59,46 @@
         self.macro[0] = ("version", "duh")
 
 
+class I18NCornerTestCase(TestCaseBase):
+
+    def test_replace_with_messageid_and_i18nname(self):
+        program, macros = self._compile(
+            '<d i18n:translate="" >'
+            '<span tal:replace="foo" i18n:name="foo_name"/>'
+            '</d>')
+        self.engine = DummyEngine()
+        self.engine.setLocal('foo', MessageID('FoOvAlUe', 'default'))
+        result = StringIO()
+        self.interpreter = TALInterpreter(program, {}, self.engine,
+                                          stream=result)
+        self.interpreter()
+        self.assertEqual('<d>FOOVALUE</d>\n', result.getvalue())
+
+
+    def test_content_with_messageid_and_i18nname(self):
+        self.engine = DummyEngine()
+        self.engine.setLocal('foo', MessageID('FoOvAlUe', 'default'))
+
+        program, macros = self._compile(
+            '<d i18n:translate="" >'
+            '<span tal:content="foo" i18n:name="foo_name"/>'
+            '</d>')
+        result = StringIO()
+        self.interpreter = TALInterpreter(program, {}, self.engine,
+                                          stream=result)
+        self.interpreter()
+        self.assertEqual('<d><span>FOOVALUE</span></d>\n', result.getvalue())
+
+        program, macros = self._compile(
+            '<span i18n:translate="" tal:content="foo" i18n:name="foo_name"/>'
+            )
+        result = StringIO()
+        self.interpreter = TALInterpreter(program, {}, self.engine,
+                                          stream=result)
+        self.interpreter()
+        self.assertEqual('<span>FOOVALUE</span>\n', result.getvalue())
+
+
 class I18NErrorsTestCase(TestCaseBase):
 
     def _check(self, src, msg):
@@ -124,6 +164,7 @@
     suite = unittest.makeSuite(I18NErrorsTestCase)
     suite.addTest(unittest.makeSuite(MacroErrorsTestCase))
     suite.addTest(unittest.makeSuite(OutputPresentationTestCase))
+    suite.addTest(unittest.makeSuite(I18NCornerTestCase))
     return suite
 
 if __name__ == "__main__":




More information about the Zope3-Checkins mailing list