[Zope-Checkins] CVS: Zope/lib/python/TAL/tests - test_talinterpreter.py:1.3.98.2
Chris McDonough
chrism@zope.com
Fri, 3 Jan 2003 01:35:14 -0500
Update of /cvs-repository/Zope/lib/python/TAL/tests
In directory cvs.zope.org:/tmp/cvs-serv27993/tests
Modified Files:
Tag: chrism-install-branch
test_talinterpreter.py
Log Message:
Merging chrism-install-branch with HEAD (hopefully for one of the last
times).
=== Zope/lib/python/TAL/tests/test_talinterpreter.py 1.3.98.1 => 1.3.98.2 ===
--- Zope/lib/python/TAL/tests/test_talinterpreter.py:1.3.98.1 Sat Sep 28 21:40:36 2002
+++ Zope/lib/python/TAL/tests/test_talinterpreter.py Fri Jan 3 01:34:42 2003
@@ -62,30 +62,31 @@
attributes=", so" the="output" needs="to"
be="line" wrapped=".">
</html>''' "\n"
- program, macros = self._compile(INPUT)
- sio = StringIO()
- interp = TALInterpreter(program, {}, DummyEngine(), sio, wrap=60)
- interp()
- self.assertEqual(sio.getvalue(), EXPECTED)
+ self.compare(INPUT, EXPECTED)
def check_unicode_content(self):
INPUT = """<p tal:content="python:u'déjà-vu'">para</p>"""
EXPECTED = u"""<p>déjà-vu</p>""" "\n"
- program, macros = self._compile(INPUT)
- sio = StringIO()
- interp = TALInterpreter(program, {}, DummyEngine(), sio, wrap=60)
- interp()
- self.assertEqual(sio.getvalue(), EXPECTED)
+ self.compare(INPUT, EXPECTED)
def check_unicode_structure(self):
INPUT = """<p tal:replace="structure python:u'déjà-vu'">para</p>"""
EXPECTED = u"""déjà-vu""" "\n"
+ self.compare(INPUT, EXPECTED)
+
+ def check_entities(self):
+ INPUT = ('<img tal:define="foo nothing" '
+ 'alt="&a;  
 &a - &; �a; <>" />')
+ EXPECTED = ('<img alt="&a;  
 '
+ '&a &#45 &; &#0a; <>" />\n')
+ self.compare(INPUT, EXPECTED)
+
+ def compare(self, INPUT, EXPECTED):
program, macros = self._compile(INPUT)
sio = StringIO()
interp = TALInterpreter(program, {}, DummyEngine(), sio, wrap=60)
interp()
self.assertEqual(sio.getvalue(), EXPECTED)
-
def test_suite():
suite = unittest.TestSuite()