[ZPT] CVS: Packages/TAL - test_htmlparser.py:1.8

guido@digicool.com guido@digicool.com
Sat, 24 Mar 2001 15:08:38 -0500 (EST)


Update of /cvs-repository/Packages/TAL/test
In directory korak:/tmp/cvs-serv19944

Modified Files:
	test_htmlparser.py 
Log Message:
Add test for handle_comment().

Remove confusing comment about entity replacement.



--- Updated File test_htmlparser.py in package Packages/TAL --
--- test_htmlparser.py	2001/03/24 19:34:08	1.7
+++ test_htmlparser.py	2001/03/24 20:08:38	1.8
@@ -44,6 +44,9 @@
 
     # all other markup
 
+    def handle_comment(self, data):
+        self.append(("comment", data))
+
     def handle_charref(self, data):
         self.append(("charref", data))
 
@@ -97,8 +100,12 @@
         self._run_check("""
 <!DOCTYPE html PUBLIC 'foo'>
 <html>&entity;&#32;
+<!--comment1a
+-></foo><bar>&lt;<?pi?></foo<bar
+comment1b-->
 <img src='bar' ismap>sample
 text
+<!--comment2a-- --comment2b-->
 </html>
 """, [
     ("data", "\n"),
@@ -108,8 +115,12 @@
     ("entityref", "entity"),
     ("charref", "32"),
     ("data", "\n"),
+    ("comment", "comment1a\n-></foo><bar>&lt;<?pi?></foo<bar\ncomment1b"),
+    ("data", "\n"),
     ("starttag", "img", [("src", "bar"), ("ismap", "ismap")]),
     ("data", "sample\ntext\n"),
+    ("comment", "comment2a-- --comment2b"),
+    ("data", "\n"),
     ("endtag", "html"),
     ("data", "\n"),
     ])
@@ -142,7 +153,6 @@
             ])
 
     def check_attr_entity_replacement(self):
-        # we expect entities *not* to be replaced by HTLMParser!
         self._run_check("""<a b='&amp;&gt;&lt;&quot;&apos;'>""", [
             ("starttag", "a", [("b", "&><\"'")]),
             ])