[Zope-Checkins] CVS: Releases/Zope/lib/python/TAL/tests - test_talinterpreter.py:1.5
Evan Simpson
evan@zope.com
Mon, 16 Dec 2002 17:52:12 -0500
Update of /cvs-repository/Releases/Zope/lib/python/TAL/tests
In directory cvs.zope.org:/tmp/cvs-serv20795/tests
Modified Files:
test_talinterpreter.py
Log Message:
Fix Collector #721 by preserving syntactically valid character entities in attributes.
=== Releases/Zope/lib/python/TAL/tests/test_talinterpreter.py 1.4 => 1.5 ===
--- Releases/Zope/lib/python/TAL/tests/test_talinterpreter.py:1.4 Wed Sep 18 11:12:48 2002
+++ Releases/Zope/lib/python/TAL/tests/test_talinterpreter.py Mon Dec 16 17:52:11 2002
@@ -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()