[Zope3-checkins] CVS: Zope3/src/zope/tal/tests -
test_htmltalparser.py:1.5.34.2
Stephan Richter
srichter at cosmos.phy.tufts.edu
Thu Aug 21 10:13:04 EDT 2003
Update of /cvs-repository/Zope3/src/zope/tal/tests
In directory cvs.zope.org:/tmp/cvs-serv29834/src/zope/tal/tests
Modified Files:
Tag: srichter-inlinepython-branch
test_htmltalparser.py
Log Message:
Fixed a bug in Templated Page (due to my changes)
Added global versus local veriable test for zope.security.interpreter
Added a couple of HTMLTALParser tests.
=== Zope3/src/zope/tal/tests/test_htmltalparser.py 1.5.34.1 => 1.5.34.2 ===
--- Zope3/src/zope/tal/tests/test_htmltalparser.py:1.5.34.1 Wed Aug 20 09:00:01 2003
+++ Zope3/src/zope/tal/tests/test_htmltalparser.py Thu Aug 21 09:13:03 2003
@@ -12,14 +12,15 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-"""Tests for the HTMLTALParser code generator."""
+"""Tests for the HTMLTALParser code generator.
+$Id$
+"""
import pprint
import sys
import unittest
-from zope.tal import htmltalparser
-from zope.tal import taldefs
+from zope.tal import htmltalparser, taldefs
from zope.tal.tests import utils
@@ -383,15 +384,56 @@
])
def test_script_1(self):
- self._run_check('<p tal:script="server-python">print "hello"</p>', [
+ self._run_check('<p tal:script="text/server-python">code</p>', [
('setPosition', (1, 0)),
- ('beginScope', {'tal:script': 'server-python'}),
- ('startTag', ('p', [('tal:script', 'server-python', 'tal')])),
- ('evaluateCode', ('server-python',
- [('rawtextOffset', ('print "hello"', 13))])),
+ ('beginScope', {'tal:script': 'text/server-python'}),
+ ('startTag', ('p',
+ [('tal:script', 'text/server-python', 'tal')])),
+ ('evaluateCode', ('text/server-python',
+ [('rawtextOffset', ('code', 4))])),
('endScope', ()),
rawtext('</p>'),
])
+
+ def test_script_2(self):
+ self._run_check('<tal:block script="text/server-python">'
+ 'code'
+ '</tal:block>', [
+ ('setPosition', (1, 0)),
+ ('beginScope', {'script': 'text/server-python'}),
+ ('optTag',
+ ('tal:block',
+ None,
+ 'tal',
+ 0,
+ [('startTag', ('tal:block',
+ [('script', 'text/server-python', 'tal')]))],
+ [('evaluateCode',
+ ('text/server-python',
+ [('rawtextOffset', ('code', 4))]))])),
+ ('endScope', ())
+ ])
+
+ def test_script_3(self):
+ self._run_check('<script type="text/server-python">code</script>', [
+ ('setPosition', (1, 0)),
+ ('beginScope', {}),
+ ('optTag',
+ ('script',
+ '',
+ None,
+ 0,
+ [('rawtextOffset', ('<script>', 8))],
+ [('evaluateCode',
+ ('text/server-python', [('rawtextOffset', ('code', 4))]))])),
+ ('endScope', ())
+ ])
+
+ def test_script_4(self):
+ self._run_check('<script type="text/javascript">code</script>', [
+ ('rawtextOffset',
+ ('<script type="text/javascript">code</script>', 44))
+ ])
def test_attributes_1(self):
self._run_check("<a href='foo' name='bar' tal:attributes="
More information about the Zope3-Checkins
mailing list