From 89961f4de3ab1e88b15dd9c0aaa0af77a7c32262 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Sun, 20 Feb 2011 15:08:51 -0500 Subject: Discovered that html5lib can't be made to support SoupStrainers, and changed the test suite appropriately. --- tests/test_html5lib.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'tests/test_html5lib.py') diff --git a/tests/test_html5lib.py b/tests/test_html5lib.py index 021c603..aa0bad2 100644 --- a/tests/test_html5lib.py +++ b/tests/test_html5lib.py @@ -1,5 +1,5 @@ -from beautifulsoup.builder.html5lib_builder import HTML5TreeBuilder -from beautifulsoup.element import Comment +from beautifulsoup.builder import HTML5TreeBuilder +from beautifulsoup.element import Comment, SoupStrainer from test_lxml import ( TestLXMLBuilder, TestLXMLBuilderInvalidMarkup, @@ -13,6 +13,15 @@ class TestHTML5Builder(TestLXMLBuilder): def default_builder(self): return HTML5TreeBuilder() + def test_soupstrainer(self): + # The html5lib tree builder does not support SoupStrainers. + strainer = SoupStrainer("b") + markup = "

A bold statement.

" + soup = self.soup(markup, + parseOnlyThese=strainer) + self.assertEquals( + soup.decode(), self.document_for(markup)) + def test_bare_string(self): # A bare string is turned into some kind of HTML document or # fragment recognizable as the original string. -- cgit v1.2.3