[ZPT] CVS: Zope3/lib/python/Zope/TAL/tests - test_htmltalparser.py:1.25.14.2.6.2

Barry Warsaw barry@wooz.org
Tue, 4 Jun 2002 12:47:29 -0400


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

Modified Files:
      Tag: fdrake-tal-i18n-branch
	test_htmltalparser.py 
Log Message:
Adjust all intermediate code tests to use the action names instead of
the (obsolete) action numbers.


=== Zope3/lib/python/Zope/TAL/tests/test_htmltalparser.py 1.25.14.2.6.1 => 1.25.14.2.6.2 ===
     def check_define_macro(self):
         macro = self.initial_program + [
-            ('startTag', ('p', [('metal:define-macro', 'M', 2)])),
+            ('startTag', ('p', [('metal:define-macro', 'M', 'metal')])),
             rawtext('booh</p>'),
             ]
         program = [
@@ -169,17 +169,17 @@
             ('setPosition', (1, 0)),
             ('useMacro',
              ('M', '$M$', {},
-              [('startTag', ('p', [('metal:use-macro', 'M', 2)])),
+              [('startTag', ('p', [('metal:use-macro', 'M', 'metal')])),
                rawtext('booh</p>')])),
             ])
 
     def check_define_slot(self):
         macro = self.initial_program + [
-            ('startTag', ('p', [('metal:define-macro', 'M', 2)])),
+            ('startTag', ('p', [('metal:define-macro', 'M', 'metal')])),
             rawtext('foo'),
             ('setPosition', (1, 29)),
             ('defineSlot', ('S',
-             [('startTag', ('span', [('metal:define-slot', 'S', 2)])),
+             [('startTag', ('span', [('metal:define-slot', 'S', 'metal')])),
               rawtext('spam</span>')])),
             rawtext('bar</p>'),
             ]
@@ -197,13 +197,13 @@
             ('useMacro',
              ('M', '$M$',
               {'S': [('startTag', ('span',
-                                   [('metal:fill-slot', 'S', 2)])),
+                                   [('metal:fill-slot', 'S', 'metal')])),
                      rawtext('spam</span>')]},
-             [('startTag', ('p', [('metal:use-macro', 'M', 2)])),
+             [('startTag', ('p', [('metal:use-macro', 'M', 'metal')])),
               rawtext('foo'),
               ('setPosition', (1, 26)),
               ('fillSlot', ('S',
-               [('startTag', ('span', [('metal:fill-slot', 'S', 2)])),
+               [('startTag', ('span', [('metal:fill-slot', 'S', 'metal')])),
                 rawtext('spam</span>')])),
               rawtext('bar</p>')])),
             ])
@@ -219,7 +219,7 @@
             ('setPosition', (1, 0)),
             ('beginScope', {'tal:define': 'xyzzy string:spam'}),
             ('setLocal', ('xyzzy', '$string:spam$')),
-            ('startTag', ('p', [('tal:define', 'xyzzy string:spam', 3)])),
+            ('startTag', ('p', [('tal:define', 'xyzzy string:spam', 'tal')])),
             ('endScope', ()),
             rawtext('</p>'),
             ])
@@ -230,7 +230,7 @@
             ('beginScope', {'tal:define': 'local xyzzy string:spam'}),
             ('setLocal', ('xyzzy', '$string:spam$')),
             ('startTag', ('p',
-             [('tal:define', 'local xyzzy string:spam', 3)])),
+             [('tal:define', 'local xyzzy string:spam', 'tal')])),
             ('endScope', ()),
             rawtext('</p>'),
             ])
@@ -241,7 +241,7 @@
             ('beginScope', {'tal:define': 'global xyzzy string:spam'}),
             ('setGlobal', ('xyzzy', '$string:spam$')),
             ('startTag', ('p',
-             [('tal:define', 'global xyzzy string:spam', 3)])),
+             [('tal:define', 'global xyzzy string:spam', 'tal')])),
             ('endScope', ()),
             rawtext('</p>'),
             ])
@@ -252,7 +252,7 @@
             ('beginScope', {'tal:define': 'x string:spam; y x'}),
             ('setLocal', ('x', '$string:spam$')),
             ('setLocal', ('y', '$x$')),
-            ('startTag', ('p', [('tal:define', 'x string:spam; y x', 3)])),
+            ('startTag', ('p', [('tal:define', 'x string:spam; y x', 'tal')])),
             ('endScope', ()),
             rawtext('</p>'),
             ])
@@ -263,7 +263,7 @@
             ('beginScope', {'tal:define': 'x string:;;;;; y x'}),
             ('setLocal', ('x', '$string:;;$')),
             ('setLocal', ('y', '$x$')),
-            ('startTag', ('p', [('tal:define', 'x string:;;;;; y x', 3)])),
+            ('startTag', ('p', [('tal:define', 'x string:;;;;; y x', 'tal')])),
             ('endScope', ()),
             rawtext('</p>'),
             ])
@@ -278,7 +278,7 @@
             ('setGlobal', ('y', '$x$')),
             ('setLocal', ('z', '$y$')),
             ('startTag', ('p',
-             [('tal:define', 'x string:spam; global y x; local z y', 3)])),
+             [('tal:define', 'x string:spam; global y x; local z y', 'tal')])),
             ('endScope', ()),
             rawtext('</p>'),
             ])
@@ -290,7 +290,7 @@
             ('setPosition', (1, 3)),
             ('beginScope', {'tal:condition': 'python:1'}),
             ('condition', ('$python:1$',
-             [('startTag', ('span', [('tal:condition', 'python:1', 3)])),
+             [('startTag', ('span', [('tal:condition', 'python:1', 'tal')])),
               rawtext('<b>foo</b></span>')])),
             ('endScope', ()),
             rawtext('</p>'),
@@ -300,7 +300,7 @@
         self._run_check("<p tal:content='string:foo'>bar</p>", [
              ('setPosition', (1, 0)),
              ('beginScope', {'tal:content': 'string:foo'}), 
-             ('startTag', ('p', [('tal:content', 'string:foo', 3)])),
+             ('startTag', ('p', [('tal:content', 'string:foo', 'tal')])),
              ('insertText', ('$string:foo$', [rawtext('bar')])),
              ('endScope', ()),
              rawtext('</p>'),
@@ -310,7 +310,7 @@
         self._run_check("<p tal:content='text string:foo'>bar</p>", [
              ('setPosition', (1, 0)),
              ('beginScope', {'tal:content': 'text string:foo'}),
-             ('startTag', ('p', [('tal:content', 'text string:foo', 3)])),
+             ('startTag', ('p', [('tal:content', 'text string:foo', 'tal')])),
              ('insertText', ('$string:foo$', [rawtext('bar')])),
              ('endScope', ()),
              rawtext('</p>'),
@@ -321,7 +321,7 @@
              ('setPosition', (1, 0)),
              ('beginScope', {'tal:content': 'structure string:<br>'}),
              ('startTag', ('p',
-              [('tal:content', 'structure string:<br>', 3)])),
+              [('tal:content', 'structure string:<br>', 'tal')])),
              ('insertStructure',
               ('$string:<br>$', {}, [rawtext('bar')])),
              ('endScope', ()),
@@ -333,7 +333,7 @@
              ('setPosition', (1, 0)),
              ('beginScope', {'tal:replace': 'string:foo'}),
              ('insertText', ('$string:foo$',
-              [('startTag', ('p', [('tal:replace', 'string:foo', 3)])),
+              [('startTag', ('p', [('tal:replace', 'string:foo', 'tal')])),
                rawtext('bar</p>')])),
              ('endScope', ()),
              ])
@@ -344,7 +344,7 @@
              ('beginScope', {'tal:replace': 'text string:foo'}),
              ('insertText', ('$string:foo$',
               [('startTag', ('p',
-                             [('tal:replace', 'text string:foo', 3)])),
+                             [('tal:replace', 'text string:foo', 'tal')])),
                rawtext('bar</p>')])),
              ('endScope', ()),
              ])
@@ -355,7 +355,7 @@
              ('beginScope', {'tal:replace': 'structure string:<br>'}),
              ('insertStructure', ('$string:<br>$', {},
               [('startTag', ('p',
-                [('tal:replace', 'structure string:<br>', 3)])),
+                [('tal:replace', 'structure string:<br>', 'tal')])),
                rawtext('bar</p>')])),
              ('endScope', ()),
              ])
@@ -367,11 +367,11 @@
              ('beginScope', {'tal:repeat': 'x python:(1,2,3)'}),
              ('loop', ('x', '$python:(1,2,3)$',
               [('startTag', ('p',
-                             [('tal:repeat', 'x python:(1,2,3)', 3)])),
+                             [('tal:repeat', 'x python:(1,2,3)', 'tal')])),
                ('setPosition', (1, 33)),
                ('beginScope', {'tal:replace': 'x'}),
                ('insertText', ('$x$',
-                [('startTag', ('span', [('tal:replace', 'x', 3)])),
+                [('startTag', ('span', [('tal:replace', 'x', 'tal')])),
                  rawtext('dummy</span>')])),
                ('endScope', ()),
                rawtext('</p>')])),
@@ -387,11 +387,11 @@
              {'tal:attributes': 'href string:http://www.zope.org; x string:y',
               'name': 'bar', 'href': 'foo'}),
             ('startTag', ('a',
-             [('href', 'foo', 0, '$string:http://www.zope.org$', 0),
+             [('href', 'foo', 'replace', '$string:http://www.zope.org$', 0),
               ('name', 'name="bar"'),
               ('tal:attributes',
-               'href string:http://www.zope.org; x string:y', 3),
-              ('x', None, 1, '$string:y$', 0)])),
+               'href string:http://www.zope.org; x string:y', 'tal'),
+              ('x', None, 'insert', '$string:y$', 0)])),
             ('endScope', ()),
             rawtext('link</a>'),
             ])
@@ -407,8 +407,9 @@
              ('$string:<img>$',
               {'src': ('$string:foo.png$', 0)},
               [('startTag', ('p',
-                             [('tal:replace', 'structure string:<img>', 3),
-                              ('tal:attributes', 'src string:foo.png', 3)])),
+                             [('tal:replace', 'structure string:<img>', 'tal'),
+                              ('tal:attributes', 'src string:foo.png',
+                               'tal')])),
                rawtext('duh</p>')])),
             ('endScope', ()),
             ])
@@ -421,13 +422,13 @@
              {'tal:content': 'notHere', 'tal:on-error': 'string:error'}),
             ('onError',
              ([('startTag', ('p',
-                [('tal:on-error', 'string:error', 3),
-                 ('tal:content', 'notHere', 3)])),
+                [('tal:on-error', 'string:error', 'tal'),
+                 ('tal:content', 'notHere', 'tal')])),
                ('insertText', ('$notHere$', [rawtext('okay')])),
                rawtext('</p>')],
               [('startTag', ('p',
-                [('tal:on-error', 'string:error', 3),
-                 ('tal:content', 'notHere', 3)])),
+                [('tal:on-error', 'string:error', 'tal'),
+                 ('tal:content', 'notHere', 'tal')])),
                ('insertText', ('$string:error$', [])),
                rawtext('</p>')])),
             ('endScope', ()),
@@ -442,12 +443,12 @@
             ('onError',
              ([('insertText', ('$notHere$',
                 [('startTag', ('p',
-                  [('tal:on-error', 'string:error', 3),
-                   ('tal:replace', 'notHere', 3)])),
+                  [('tal:on-error', 'string:error', 'tal'),
+                   ('tal:replace', 'notHere', 'tal')])),
                  rawtext('okay</p>')]))],
               [('startTag', ('p',
-                [('tal:on-error', 'string:error', 3),
-                 ('tal:replace', 'notHere', 3)])),
+                [('tal:on-error', 'string:error', 'tal'),
+                 ('tal:replace', 'notHere', 'tal')])),
                ('insertText', ('$string:error$', [])),
                rawtext('</p>')])),
             ('endScope', ()),
@@ -481,8 +482,8 @@
         self._run_check("<img alt='foo' i18n:attributes='alt'>", [
             ('setPosition', (1, 0)),
             ('startTag', ('img',
-             [('alt', 'foo', 0, None, 1),
-              ('i18n:attributes', 'alt', 3)])),
+             [('alt', 'foo', 'replace', None, 1),
+              ('i18n:attributes', 'alt', 'tal')])),
             ])