summaryrefslogtreecommitdiff
path: root/tests/test_html5lib.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2011-02-20 15:08:51 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2011-02-20 15:08:51 -0500
commit89961f4de3ab1e88b15dd9c0aaa0af77a7c32262 (patch)
tree76d78c8831f0acb5a3a41bc628ffbd62b0bbfc6d /tests/test_html5lib.py
parent6de230d1f201c686d56e5f5a5241db69c316cea8 (diff)
Discovered that html5lib can't be made to support SoupStrainers, and changed the test suite appropriately.
Diffstat (limited to 'tests/test_html5lib.py')
-rw-r--r--tests/test_html5lib.py13
1 files changed, 11 insertions, 2 deletions
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 = "<p>A <b>bold</b> statement.</p>"
+ 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.