summaryrefslogtreecommitdiffstats
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 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-03-30 14:25:40 (GMT)
commit3163a3b4b2a820ef38e6c7282033fe2db9d43ebe (patch)
treee83e06cbe049f06610d6c5e025e813e644fc9b01 /Lib/test/test_htmllib.py
parenta965649386dbd385a92b2b93934abaff80c94198 (diff)
downloadcpython-3163a3b4b2a820ef38e6c7282033fe2db9d43ebe.zip
cpython-3163a3b4b2a820ef38e6c7282033fe2db9d43ebe.tar.gz
cpython-3163a3b4b2a820ef38e6c7282033fe2db9d43ebe.tar.bz2
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 e283d11..a20f43b 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)