[Python-checkins] python/dist/src/Lib/test test_htmllib.py,1.2,1.3
loewis@users.sourceforge.net
loewis@users.sourceforge.net
Sun, 30 Mar 2003 06:25:42 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv1474/Lib/test
Modified Files:
test_htmllib.py
Log Message:
Patch #545300: Support marked sections.
Index: test_htmllib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_htmllib.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** test_htmllib.py 23 Jul 2002 19:03:54 -0000 1.2
--- test_htmllib.py 30 Mar 2003 14:25:39 -0000 1.3
***************
*** 17,20 ****
--- 17,31 ----
self.__anchors.append(args)
+ class DeclCollector(htmllib.HTMLParser):
+ def __init__(self, *args, **kw):
+ self.__decls = []
+ htmllib.HTMLParser.__init__(self, *args, **kw)
+
+ def get_decl_info(self):
+ return self.__decls
+
+ def unknown_decl(self, data):
+ self.__decls.append(data)
+
class HTMLParserTestCase(unittest.TestCase):
***************
*** 34,37 ****
--- 45,64 ----
])
+ def test_decl_collection(self):
+ # See SF patch #545300
+ parser = DeclCollector(formatter.NullFormatter(), verbose=1)
+ parser.feed(
+ """<html>
+ <body>
+ hallo
+ <![if !supportEmptyParas]> <![endif]>
+ </body>
+ </html>
+ """)
+ parser.close()
+ self.assertEquals(parser.get_decl_info(),
+ ["if !supportEmptyParas",
+ "endif"
+ ])
def test_main():