[Zope-Checkins] CVS: Zope3/lib/python/Zope/TAL/tests - test_htmltalparser.py:1.32.6.2
Barry Warsaw
barry@wooz.org
Wed, 26 Jun 2002 17:24:37 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/TAL/tests
In directory cvs.zope.org:/tmp/cvs-serv8508/lib/python/Zope/TAL/tests
Modified Files:
Tag: tal-i18n-refactor-branch
test_htmltalparser.py
Log Message:
Finishing up the TAL/I18n refactoring.
Update the test structures for tal/i18n.
=== Zope3/lib/python/Zope/TAL/tests/test_htmltalparser.py 1.32.6.1 => 1.32.6.2 ===
def check_i18n_translate(self):
+ # input/test19.html
self._run_check('''\
<span i18n:translate="">Replace this</span>
<span i18n:translate="msgid">This is a
@@ -567,11 +568,11 @@
{'i18n:name': 'name', 'tal:replace': 'str:Lomax'})),
('i18nVariable',
('name',
- '$str:Lomax$',
[('startEndTag',
('span',
[('tal:replace', 'str:Lomax', 'tal'),
- ('i18n:name', 'name', 'i18n')]))])),
+ ('i18n:name', 'name', 'i18n')]))],
+ '$str:Lomax$')),
('rawtextBeginScope',
(' was born in\n ',
2,
@@ -580,11 +581,11 @@
{'i18n:name': 'country', 'tal:replace': 'str:Antarctica'})),
('i18nVariable',
('country',
- '$str:Antarctica$',
[('startEndTag',
('span',
[('tal:replace', 'str:Antarctica', 'tal'),
- ('i18n:name', 'country', 'i18n')]))])),
+ ('i18n:name', 'country', 'i18n')]))],
+ '$str:Antarctica$')),
('endScope', ()),
('rawtextColumn', ('.\n', 0))])),
('endScope', ()),
@@ -592,6 +593,7 @@
])
def check_i18n_name_implicit_value(self):
+ # input/test22.html
self._run_check('''\
<span i18n:translate="">
<span i18n:name="name"><b>Jim</b></span> was born in
@@ -606,16 +608,12 @@
[('rawtextBeginScope', ('\n ', 2, (2, 2), 0, {'i18n:name': 'name'})),
('i18nVariable',
('name',
- [('rawtextOffset', ('<b>Jim</b>', 10))],
- [('startTag', ('span', [('i18n:name', 'name', 'i18n')])),
- ('rawtextOffset', ('<b>Jim</b></span>', 17))])),
+ [('rawtextOffset', ('<b>Jim</b>', 10))], None)),
('rawtextBeginScope',
(' was born in\n ', 2, (3, 2), 1, {'i18n:name': 'country'})),
('i18nVariable',
('country',
- [('rawtextOffset', ('the USA', 7))],
- [('startTag', ('span', [('i18n:name', 'country', 'i18n')])),
- ('rawtextOffset', ('the USA</span>', 14))])),
+ [('rawtextOffset', ('the USA', 7))], None)),
('endScope', ()),
('rawtextColumn', ('.\n', 0))])),
('endScope', ()),
@@ -703,6 +701,7 @@
])
def check_i18n_data_with_name(self):
+ # input/test29.html
self._run_check('''\
At the tone the time will be
<span i18n:data="here/currentTime"
@@ -717,22 +716,15 @@
{'i18n:data': 'here/currentTime',
'i18n:name': 'time',
'i18n:translate': 'timefmt'})),
- ('i18nVariable',
- ('time',
- [('insertTranslation',
- ('timefmt',
- [('rawtextOffset', ('2:32 pm', 7))],
- '$here/currentTime$'))],
+ ('insertTranslation',
+ ('timefmt',
[('startTag',
('span',
[('i18n:data', 'here/currentTime', 'i18n'),
('i18n:translate', 'timefmt', 'i18n'),
('i18n:name', 'time', 'i18n')])),
- ('insertTranslation',
- ('timefmt',
- [('rawtextOffset', ('2:32 pm', 7))],
- '$here/currentTime$')),
- ('rawtextOffset', ('</span>', 7))])),
+ ('i18nVariable', ('time', [], None))],
+ '$here/currentTime$')),
('endScope', ()),
('rawtextColumn', ('... beep!\n', 0))
])
@@ -757,12 +749,13 @@
{'i18n:name': 'jobnum', 'tal:replace': 'context/@@object_name'})),
('i18nVariable',
('jobnum',
- '$context/@@object_name$',
[('startTag',
('span',
[('tal:replace', 'context/@@object_name', 'tal'),
('i18n:name', 'jobnum', 'i18n')])),
- ('rawtextOffset', ('NN</span>', 9))])),
+ ('rawtextOffset', ('NN', 2)),
+ ('rawtextOffset', ('</span>', 7))],
+ '$context/@@object_name$')),
('endScope', ())])),
('endScope', ()),
('rawtextColumn', ('</span>\n', 0))
@@ -805,7 +798,8 @@
('$request/submitter$',
[('rawtextOffset', ('user@host.com', 13))])),
('endScope', ()),
- ('rawtextOffset', ('</a>', 4))])),
+ ('rawtextOffset', ('</a>', 4))],
+ None)),
('endScope', ()),
('rawtextColumn', ('\n', 0))])),
('endScope', ()),
@@ -844,7 +838,8 @@
('insertText',
('$request/submitter$',
[('rawtextOffset', ('user@host.com', 13))])),
- ('rawtextOffset', ('</a>', 4))])),
+ ('rawtextOffset', ('</a>', 4))],
+ None)),
('endScope', ()),
('rawtextColumn', ('\n', 0))])),
('endScope', ()),