[Zope-Checkins] CVS: Zope3/lib/python/Zope/TAL/tests - test_htmltalparser.py:1.25.14.2.6.9

Barry Warsaw barry@wooz.org
Tue, 11 Jun 2002 15:48:39 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/TAL/tests
In directory cvs.zope.org:/tmp/cvs-serv21961/tests

Modified Files:
      Tag: fdrake-tal-i18n-branch
	test_htmltalparser.py 
Log Message:
Added two i18n:data tests:

- check_i18n_data
- check_i18n_data_with_name


=== Zope3/lib/python/Zope/TAL/tests/test_htmltalparser.py 1.25.14.2.6.8 => 1.25.14.2.6.9 ===
             ])
 
+    def check_i18n_data(self):
+        self._run_check('''\
+<span i18n:data="here/currentTime"
+      i18n:translate="timefmt">2:32 pm</span>
+''', [
+  ('setPosition', (1, 0)),
+  ('beginScope',
+   {'i18n:translate': 'timefmt', 'i18n:data': 'here/currentTime'}),
+  ('startTag',
+   ('span',
+    [('i18n:data', 'here/currentTime', 'i18n'),
+     ('i18n:translate', 'timefmt', 'i18n')])),
+  ('insertTranslation',
+   ('timefmt', [('rawtextOffset', ('2:32 pm', 7))], '$here/currentTime$')),
+  ('endScope', ()),
+  ('rawtextColumn', ('</span>\n', 0))
+  ])
+
+    def check_i18n_data_with_name(self):
+        self._run_check('''\
+At the tone the time will be
+<span i18n:data="here/currentTime"
+      i18n:translate="timefmt"
+      i18n:name="time">2:32 pm</span>... beep!
+''', [
+  ('rawtextBeginScope',
+   ('At the tone the time will be\n',
+    0,
+    (2, 0),
+    0,
+    {'i18n:data': 'here/currentTime',
+     'i18n:name': 'time',
+     'i18n:translate': 'timefmt'})),
+  ('i18nVariable',
+   ('time',
+    [('insertTranslation',
+      ('timefmt',
+       [('rawtextOffset', ('2:32 pm', 7))],
+       '$here/currentTime$'))],
+    [('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))])),
+  ('endScope', ()),
+  ('rawtextColumn', ('... beep!\n', 0))
+  ])
+
 
 def test_suite():
     suite = unittest.TestSuite()