summaryrefslogtreecommitdiff
path: root/Lib/test/test_htmllib.py
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-03-30 14:25:40 +0000
committerMartin v. Löwis <martin@v.loewis.de>2003-03-30 14:25:40 +0000
commit419f2aaa26088e285044eeb72b72a0b55c9f8da1 (patch)
treebed9d517ff1aaeee3e1a7e41bd972ced34441196 /Lib/test/test_htmllib.py
parentdb89c4efab4a52afcf442c0b3b2b6c4c5a66908f (diff)
downloadcpython-419f2aaa26088e285044eeb72b72a0b55c9f8da1.tar.gz
Patch #545300: Support marked sections.
Diffstat (limited to 'Lib/test/test_htmllib.py')
-rw-r--r--Lib/test/test_htmllib.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/Lib/test/test_htmllib.py b/Lib/test/test_htmllib.py
index e283d1118f..a20f43bbf1 100644
--- a/Lib/test/test_htmllib.py
+++ b/Lib/test/test_htmllib.py
@@ -16,6 +16,17 @@ class AnchorCollector(htmllib.HTMLParser):
def anchor_bgn(self, *args):
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):
def test_anchor_collection(self):
@@ -33,6 +44,22 @@ class HTMLParserTestCase(unittest.TestCase):
('', 'frob', ''),
])
+ def test_decl_collection(self):
+ # See SF patch #545300
+ parser = DeclCollector(formatter.NullFormatter(), verbose=1)
+ parser.feed(
+ """<html>
+ <body>
+ hallo
+ <![if !supportEmptyParas]>&nbsp;<![endif]>
+ </body>
+ </html>
+ """)
+ parser.close()
+ self.assertEquals(parser.get_decl_info(),
+ ["if !supportEmptyParas",
+ "endif"
+ ])
def test_main():
test_support.run_unittest(HTMLParserTestCase)