[Zope3-checkins] CVS: Zope3/src/zope/tal/tests -
test_talinterpreter.py:1.3.4.8
Stephan Richter
srichter at cosmos.phy.tufts.edu
Fri Aug 8 15:54:29 EDT 2003
Update of /cvs-repository/Zope3/src/zope/tal/tests
In directory cvs.zope.org:/tmp/cvs-serv12972/src/zope/tal/tests
Modified Files:
Tag: srichter-i18n-macro-interaction-branch
test_talinterpreter.py
Log Message:
Checkpoint for Fred.
=== Zope3/src/zope/tal/tests/test_talinterpreter.py 1.3.4.7 => 1.3.4.8 ===
--- Zope3/src/zope/tal/tests/test_talinterpreter.py:1.3.4.7 Fri Aug 8 14:29:37 2003
+++ Zope3/src/zope/tal/tests/test_talinterpreter.py Fri Aug 8 14:54:25 2003
@@ -19,7 +19,7 @@
from StringIO import StringIO
-from zope.tal.taldefs import METALError, TALError, I18NError
+from zope.tal.taldefs import METALError, I18NError
from zope.tal.htmltalparser import HTMLTALParser
from zope.tal.talinterpreter import TALInterpreter
from zope.tal.dummyengine import DummyEngine
@@ -70,7 +70,7 @@
self.interpreter()
self.assertEqual(expected, result.getvalue())
- def _test_simple_messageid_translate(self):
+ 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"/>')
@@ -79,28 +79,28 @@
program, macros = self._compile('<span tal:replace="foo"/>')
self._check(program, 'FOOVALUE\n')
- def _test_replace_with_messageid_and_i18nname(self):
+ def test_replace_with_messageid_and_i18nname(self):
program, macros = self._compile(
'<div i18n:translate="" >'
'<span tal:replace="foo" i18n:name="foo_name"/>'
'</div>')
self._check(program, '<div>FOOVALUE</div>\n')
- def _test_pythonexpr_replace_with_messageid_and_i18nname(self):
+ def test_pythonexpr_replace_with_messageid_and_i18nname(self):
program, macros = self._compile(
'<div i18n:translate="" >'
'<span tal:replace="python: foo" i18n:name="foo_name"/>'
'</div>')
self._check(program, '<div>FOOVALUE</div>\n')
- def _test_structure_replace_with_messageid_and_i18nname(self):
+ def test_structure_replace_with_messageid_and_i18nname(self):
program, macros = self._compile(
'<div i18n:translate="" >'
'<span tal:replace="structure foo" i18n:name="foo_name"/>'
'</div>')
self._check(program, '<div>FOOVALUE</div>\n')
- def _test_complex_replace_with_messageid_and_i18nname(self):
+ def test_complex_replace_with_messageid_and_i18nname(self):
program, macros = self._compile(
'<div i18n:translate="" >'
'<em i18n:name="foo_name">'
@@ -109,7 +109,7 @@
'</div>')
self._check(program, '<div>FOOVALUE</div>\n')
- def _test_content_with_messageid_and_i18nname(self):
+ def test_content_with_messageid_and_i18nname(self):
program, macros = self._compile(
'<div i18n:translate="" >'
'<span tal:content="foo" i18n:name="foo_name"/>'
@@ -117,16 +117,24 @@
self._check(program, '<div><span>FOOVALUE</span></div>\n')
def test_content_with_messageid_and_i18nname_and_i18ntranslate(self):
+ # Let's tell the user this is incredibly silly!
self.assertRaises(
- TALError,
- self._compile,
+ I18NError, self._compile,
'<span i18n:translate="" tal:content="foo" i18n:name="foo_name"/>')
def test_content_with_plaintext_and_i18nname_and_i18ntranslate(self):
- # Let's tell the user this is incredibly silly!
self.assertRaises(
- TALError, self._compile,
+ I18NError, self._compile,
'<span i18n:translate="" i18n:name="color_name">green</span>')
+
+ def test_translate_static_text_as_dynamic(self):
+ # The follwoing code is also dumb; tell the user just that!
+ program, macros = self._compile(
+ '<div i18n:translate="">This is text for '
+ '<span i18n:translate="" tal:content="foo" '
+ 'i18n:name="foo_name"/>.</div>')
+ self._check(program,
+ '<div>THIS IS TEXT FOR <span>FOOVALUE</span></div>\n')
class I18NErrorsTestCase(TestCaseBase):
More information about the Zope3-Checkins
mailing list