[Zope3-checkins] CVS: Zope3/src/zope/tal/tests -
test_talinterpreter.py:1.3.4.3
Stephan Richter
srichter at cosmos.phy.tufts.edu
Fri Aug 8 13:46:38 EDT 2003
Update of /cvs-repository/Zope3/src/zope/tal/tests
In directory cvs.zope.org:/tmp/cvs-serv24099/src/zope/tal/tests
Modified Files:
Tag: srichter-i18n-macro-interaction-branch
test_talinterpreter.py
Log Message:
Fixed one bug, found two more.
=== Zope3/src/zope/tal/tests/test_talinterpreter.py 1.3.4.2 => 1.3.4.3 ===
--- Zope3/src/zope/tal/tests/test_talinterpreter.py:1.3.4.2 Fri Aug 8 11:58:10 2003
+++ Zope3/src/zope/tal/tests/test_talinterpreter.py Fri Aug 8 12:46:33 2003
@@ -61,7 +61,7 @@
class I18NCornerTestCase(TestCaseBase):
- def XXXtest_simple_messageid_translate(self):
+ def test_simple_messageid_translate(self):
# This test is mainly here to make sure our DummyEngine works
# correctly.
self.engine = DummyEngine()
@@ -74,6 +74,14 @@
self.interpreter()
self.assertEqual('<span>FOOVALUE</span>\n', result.getvalue())
+ program, macros = self._compile('<span tal:replace="foo"/>')
+ result = StringIO()
+ self.interpreter = TALInterpreter(program, {}, self.engine,
+ stream=result)
+ self.interpreter()
+ self.assertEqual('FOOVALUE\n', result.getvalue())
+
+
def test_replace_with_messageid_and_i18nname(self):
program, macros = self._compile(
'<d i18n:translate="" >'
@@ -88,7 +96,51 @@
self.assertEqual('<d>FOOVALUE</d>\n', result.getvalue())
- def XXXtest_content_with_messageid_and_i18nname(self):
+ def test_pythonexpr_replace_with_messageid_and_i18nname(self):
+ program, macros = self._compile(
+ '<d i18n:translate="" >'
+ '<span tal:replace="python: 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_structure_replace_with_messageid_and_i18nname(self):
+ program, macros = self._compile(
+ '<d i18n:translate="" >'
+ '<span tal:replace="structure 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_complex_replace_with_messageid_and_i18nname(self):
+ program, macros = self._compile(
+ '<div i18n:translate="" >'
+ '<em i18n:name="foo_name">'
+ '<span tal:replace="foo"/>'
+ '</em>'
+ '</div>')
+ self.engine = DummyEngine()
+ self.engine.setLocal('foo', MessageID('FoOvAlUe', 'default'))
+ result = StringIO()
+ self.interpreter = TALInterpreter(program, {}, self.engine,
+ stream=result)
+ self.interpreter()
+ self.assertEqual('<div>FOOVALUE</div>\n', result.getvalue())
+
+
+ def test_content_with_messageid_and_i18nname(self):
self.engine = DummyEngine()
self.engine.setLocal('foo', MessageID('FoOvAlUe', 'default'))
More information about the Zope3-Checkins
mailing list