[Zope3-checkins] CVS: Zope3/src/zope/tal/tests -
test_talinterpreter.py:1.8.2.2
Godefroid Chapelle
gotcha at swing.be
Tue Sep 9 18:58:36 EDT 2003
Update of /cvs-repository/Zope3/src/zope/tal/tests
In directory cvs.zope.org:/tmp/cvs-serv14260
Modified Files:
Tag: srichter-tal_i18n_take2-branch
test_talinterpreter.py
Log Message:
add supplementary failing test, cleaned others to get them more understandable
=== Zope3/src/zope/tal/tests/test_talinterpreter.py 1.8.2.1 => 1.8.2.2 ===
--- Zope3/src/zope/tal/tests/test_talinterpreter.py:1.8.2.1 Thu Aug 21 10:45:44 2003
+++ Zope3/src/zope/tal/tests/test_talinterpreter.py Tue Sep 9 17:58:35 2003
@@ -66,6 +66,7 @@
def setUp(self):
self.engine = DummyEngine()
self.engine.setLocal('foo', MessageID('FoOvAlUe', 'default'))
+ self.engine.setLocal('egg', MessageID('egg-id', 'default', 'EgGvAlUe'))
self.engine.setLocal('bar', 'BaRvAlUe')
def _check(self, program, expected):
@@ -78,32 +79,56 @@
def test_simple_messageid_translate(self):
# This test is mainly here to make sure our DummyEngine works
# correctly.
- program, macros = self._compile('<span tal:content="foo"/>')
+ program, macros = self._compile('<span i18n:translate="" tal:content="foo"/>')
self._check(program, '<span>FOOVALUE</span>\n')
+ program, macros = self._compile('<span i18n:translate="" tal:content="egg"/>')
+ self._check(program, '<span>EGG-ID</span>\n')
+
+ def test_simple_messageid_notranslate(self):
+ # This test is mainly here to make sure our DummyEngine works
+ # correctly.
+ program, macros = self._compile('<span tal:content="foo"/>')
+ self._check(program, '<span>FoOvAlUe</span>\n')
program, macros = self._compile('<span tal:replace="foo"/>')
- self._check(program, 'FOOVALUE\n')
+ self._check(program, 'FoOvAlUe\n')
+
+ program, macros = self._compile('<span tal:content="egg"/>')
+ self._check(program, '<span>EgGvAlUe</span>\n')
+
+ program, macros = self._compile('<span tal:replace="egg"/>')
+ self._check(program, 'EgGvAlUe\n')
def test_translate_with_static_i18nname(self):
program, macros = self._compile(
- '<p i18n:translate="" >foo'
+ '<p i18n:translate="" >spam'
'<span i18n:name="foo_name">bar</span>'
'</p>')
- self._check(program, '<p>FOO<span>bar</span></p>\n')
+ self._check(program, '<p>SPAM<span>bar</span></p>\n')
def test_translate_with_static_i18nname_and_omittag(self):
program, macros = self._compile(
- '<p i18n:translate="" >foo'
+ '<p i18n:translate="" >spam'
'<span tal:omit-tag="" i18n:name="foo_name">bar</span>'
'</p>')
- self._check(program, '<p>FOObar</p>\n')
+ self._check(program, '<p>SPAMbar</p>\n')
def test_replace_with_messageid_and_i18nname(self):
program, macros = self._compile(
- '<div i18n:translate="" >'
+ '<div i18n:translate="">'
'<span tal:replace="foo" i18n:name="foo_name"/>'
'</div>')
self._check(program, '<div>FOOVALUE</div>\n')
+
+ def test_i18n_in_tal_namespace(self):
+ program, macros = self._compile(
+ '<tal:i18n content="string:spam" i18n:translate="" />')
+ self._check(program, 'SPAM\n')
+
+ def test_i18n_namespace(self):
+ program, macros = self._compile(
+ '<i18n:spam translate="">spam</i18n:spam>')
+ self._check(program, 'SPAM\n')
def test_pythonexpr_replace_with_messageid_and_i18nname(self):
program, macros = self._compile(
More information about the Zope3-Checkins
mailing list