[ZPT] CVS: Packages/TAL - test_htmltalparser.py:1.11
guido@digicool.com
guido@digicool.com
Sat, 7 Apr 2001 15:51:56 -0400 (EDT)
Update of /cvs-repository/Packages/TAL/test
In directory korak:/tmp/cvs-serv10986
Modified Files:
test_htmltalparser.py
Log Message:
Update test output to match version 1.0.1 of the code generator.
All test should succeed now (both TAL/test/run.py and TAL/runtest.py).
--- Updated File test_htmltalparser.py in package Packages/TAL --
--- test_htmltalparser.py 2001/04/06 19:54:18 1.10
+++ test_htmltalparser.py 2001/04/07 19:51:55 1.11
@@ -138,7 +138,7 @@
def check_define_macro(self):
macro = [('startTag', 'p',
- [('metal:define-macro', 'M', 'macroHack')]),
+ [('metal:define-macro', 'M', 'metal')]),
('rawtext', 'booh</p>')]
program = [
('setPosition', (1, 0)),
@@ -152,16 +152,18 @@
('setPosition', (1, 0)),
('useMacro',
'M', '$M$', {},
- [('rawtext', '<p metal:use-macro="M">booh</p>')]),
+ [('startTag', 'p', [('metal:use-macro', 'M', 'metal')]),
+ ('rawtext', 'booh</p>')]),
])
def check_define_slot(self):
macro = [
- ('startTag', 'p', [('metal:define-macro', 'M', 'macroHack')]),
+ ('startTag', 'p', [('metal:define-macro', 'M', 'metal')]),
('rawtext', 'foo'),
('setPosition', (1, 29)),
('defineSlot', 'S',
- [('rawtext', '<span metal:define-slot="S">spam</span>')]),
+ [('startTag', 'span', [('metal:define-slot', 'S', 'metal')]),
+ ('rawtext', 'spam</span>')]),
('rawtext', 'bar</p>'),
]
program = [('setPosition', (1, 0)),
@@ -177,11 +179,14 @@
('setPosition', (1, 0)),
('useMacro',
'M', '$M$',
- {'S': [('rawtext', '<span metal:fill-slot="S">spam</span>')]},
- [('rawtext', '<p metal:use-macro="M">foo'),
+ {'S': [('startTag', 'span', [('metal:fill-slot', 'S', 'metal')]),
+ ('rawtext', 'spam</span>')]},
+ [('startTag', 'p', [('metal:use-macro', 'M', 'metal')]),
+ ('rawtext', 'foo'),
('setPosition', (1, 26)),
('fillSlot', 'S',
- [('rawtext', '<span metal:fill-slot="S">spam</span>')]),
+ [('startTag', 'span', [('metal:fill-slot', 'S', 'metal')]),
+ ('rawtext', 'spam</span>')]),
('rawtext', 'bar</p>')]),
])
@@ -196,21 +201,26 @@
('setPosition', (1, 0)),
('beginScope',),
('setLocal', 'xyzzy', '$string:spam$'),
- ('rawtext', '<p tal:define="xyzzy string:spam"></p>'),
+ ('startTag', 'p', [('tal:define', 'xyzzy string:spam', 'tal')]),
+ ('rawtext', '</p>'),
('endScope',),
])
self._run_check("<p tal:define='local xyzzy string:spam'></p>", [
('setPosition', (1, 0)),
('beginScope',),
('setLocal', 'xyzzy', '$string:spam$'),
- ('rawtext', '<p tal:define="local xyzzy string:spam"></p>'),
+ ('startTag', 'p',
+ [('tal:define', 'local xyzzy string:spam', 'tal')]),
+ ('rawtext', '</p>'),
('endScope',),
])
self._run_check("<p tal:define='global xyzzy string:spam'></p>", [
('setPosition', (1, 0)),
('beginScope',),
('setGlobal', 'xyzzy', '$string:spam$'),
- ('rawtext', '<p tal:define="global xyzzy string:spam"></p>'),
+ ('startTag', 'p',
+ [('tal:define', 'global xyzzy string:spam', 'tal')]),
+ ('rawtext', '</p>'),
('endScope',),
])
self._run_check("<p tal:define='x string:spam; y x'></p>", [
@@ -218,7 +228,8 @@
('beginScope',),
('setLocal', 'x', '$string:spam$'),
('setLocal', 'y', '$x$'),
- ('rawtext', '<p tal:define="x string:spam; y x"></p>'),
+ ('startTag', 'p', [('tal:define', 'x string:spam; y x', 'tal')]),
+ ('rawtext', '</p>'),
('endScope',),
])
self._run_check("<p tal:define='x string:;;;;; y x'></p>", [
@@ -226,7 +237,8 @@
('beginScope',),
('setLocal', 'x', '$string:;;$'),
('setLocal', 'y', '$x$'),
- ('rawtext', '<p tal:define="x string:;;;;; y x"></p>'),
+ ('startTag', 'p', [('tal:define', 'x string:;;;;; y x', 'tal')]),
+ ('rawtext', '</p>'),
('endScope',),
])
self._run_check(
@@ -236,8 +248,9 @@
('setLocal', 'x', '$string:spam$'),
('setGlobal', 'y', '$x$'),
('setLocal', 'z', '$y$'),
- ('rawtext',
- '<p tal:define="x string:spam; global y x; local z y"></p>'),
+ ('startTag', 'p',
+ [('tal:define', 'x string:spam; global y x; local z y', 'tal')]),
+ ('rawtext', '</p>'),
('endScope',),
])
@@ -247,27 +260,28 @@
('rawtext', '<p>'),
('setPosition', (1, 3)),
('condition', '$python:1$',
- [('rawtext',
- '<span tal:condition="python:1"><b>foo</b></span>')]),
+ [('startTag', 'span', [('tal:condition', 'python:1', 'tal')]),
+ ('rawtext', '<b>foo</b></span>')]),
('rawtext', '</p>'),
])
def check_content(self):
self._run_check("<p tal:content='string:foo'>bar</p>", [
('setPosition', (1, 0)),
- ('rawtext', '<p tal:content="string:foo">'),
+ ('startTag', 'p', [('tal:content', 'string:foo', 'tal')]),
('insertText', '$string:foo$', [('rawtext', 'bar')]),
('rawtext', '</p>'),
])
self._run_check("<p tal:content='text string:foo'>bar</p>", [
('setPosition', (1, 0)),
- ('rawtext', '<p tal:content="text string:foo">'),
+ ('startTag', 'p', [('tal:content', 'text string:foo', 'tal')]),
('insertText', '$string:foo$', [('rawtext', 'bar')]),
('rawtext', '</p>'),
])
self._run_check("<p tal:content='structure string:<br>'>bar</p>", [
('setPosition', (1, 0)),
- ('rawtext', '<p tal:content="structure string:<br>">'),
+ ('startTag', 'p',
+ [('tal:content', 'structure string:<br>', 'tal')]),
('insertStructure', '$string:<br>$', {}, [('rawtext', 'bar')]),
('rawtext', '</p>'),
])
@@ -276,18 +290,21 @@
self._run_check("<p tal:replace='string:foo'>bar</p>", [
('setPosition', (1, 0)),
('insertText', '$string:foo$',
- [('rawtext', '<p tal:replace="string:foo">bar</p>')]),
+ [('startTag', 'p', [('tal:replace', 'string:foo', 'tal')]),
+ ('rawtext', 'bar</p>')]),
])
self._run_check("<p tal:replace='text string:foo'>bar</p>", [
('setPosition', (1, 0)),
('insertText', '$string:foo$',
- [('rawtext', '<p tal:replace="text string:foo">bar</p>')]),
+ [('startTag', 'p', [('tal:replace', 'text string:foo', 'tal')]),
+ ('rawtext', 'bar</p>')]),
])
self._run_check("<p tal:replace='structure string:<br>'>bar</p>", [
('setPosition', (1, 0)),
('insertStructure', '$string:<br>$', {},
- [('rawtext',
- '<p tal:replace="structure string:<br>">bar</p>')]),
+ [('startTag', 'p',
+ [('tal:replace', 'structure string:<br>', 'tal')]),
+ ('rawtext', 'bar</p>')]),
])
def check_repeat(self):
@@ -296,10 +313,11 @@
('setPosition', (1, 0)),
('beginScope',),
('loop', 'x', '$python:(1,2,3)$',
- [('rawtext', '<p tal:repeat="x python:(1,2,3)">'),
+ [('startTag', 'p', [('tal:repeat', 'x python:(1,2,3)', 'tal')]),
('setPosition', (1, 33)),
('insertText', '$x$',
- [('rawtext', '<span tal:replace="x">dummy</span>')]),
+ [('startTag', 'span', [('tal:replace', 'x', 'tal')]),
+ ('rawtext', 'dummy</span>')]),
('rawtext', '</p>')]),
('endScope',),
])
@@ -313,7 +331,7 @@
[('href', 'foo', 'replace', '$string:http://www.zope.org$'),
('name', 'bar'),
('tal:attributes',
- 'href string:http://www.zope.org; x string:y'),
+ 'href string:http://www.zope.org; x string:y', 'tal'),
('x', '', 'replace', '$string:y$')]),
('rawtext', 'link</a>'),
])
@@ -322,9 +340,10 @@
('setPosition', (1, 0)),
('insertStructure', '$string:<img>$',
{'src': '$string:foo.png$'},
- [('rawtext',
- '<p tal:replace="structure string:<img>" '
- 'tal:attributes="src string:foo.png">duh</p>')]),
+ [('startTag', 'p',
+ [('tal:replace', 'structure string:<img>', 'tal'),
+ ('tal:attributes', 'src string:foo.png', 'tal')]),
+ ('rawtext', 'duh</p>')]),
])
def check_on_error(self):
@@ -332,12 +351,14 @@
"tal:content='notHere'>okay</p>", [
('setPosition', (1, 0)),
('onError',
- [('rawtext',
- '<p tal:on-error="string:error" tal:content="notHere">'),
+ [('startTag', 'p',
+ [('tal:on-error', 'string:error', 'tal'),
+ ('tal:content', 'notHere', 'tal')]),
('insertText', '$notHere$', [('rawtext', 'okay')]),
('rawtext', '</p>')],
- [('rawtext',
- '<p tal:on-error="string:error" tal:content="notHere">'),
+ [('startTag', 'p',
+ [('tal:on-error', 'string:error', 'tal'),
+ ('tal:content', 'notHere', 'tal')]),
('insertText', '$string:error$', []),
('rawtext', '</p>')]),
])
@@ -346,11 +367,13 @@
('setPosition', (1, 0)),
('onError',
[('insertText', '$notHere$',
- [('rawtext',
- '<p tal:on-error="string:error" '
- 'tal:replace="notHere">okay</p>')])],
- [('rawtext',
- '<p tal:on-error="string:error" tal:replace="notHere">'),
+ [('startTag', 'p',
+ [('tal:on-error', 'string:error', 'tal'),
+ ('tal:replace', 'notHere', 'tal')]),
+ ('rawtext', 'okay</p>')])],
+ [('startTag', 'p',
+ [('tal:on-error', 'string:error', 'tal'),
+ ('tal:replace', 'notHere', 'tal')]),
('insertText', '$string:error$', []),
('rawtext', '</p>')]),
])