diff options
Diffstat (limited to 'bs4/tests/test_html5lib.py')
-rw-r--r-- | bs4/tests/test_html5lib.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bs4/tests/test_html5lib.py b/bs4/tests/test_html5lib.py index b32ab30..de30bc8 100644 --- a/bs4/tests/test_html5lib.py +++ b/bs4/tests/test_html5lib.py @@ -7,6 +7,7 @@ try: HTML5LIB_PRESENT = True except ImportError as e: HTML5LIB_PRESENT = False +from bs4 import BeautifulSoup from bs4.element import SoupStrainer from . import ( HTML5TreeBuilderSmokeTest, @@ -29,10 +30,12 @@ class TestHTML5LibBuilder(SoupTest, HTML5TreeBuilderSmokeTest): strainer = SoupStrainer("b") markup = "<p>A <b>bold</b> statement.</p>" with warnings.catch_warnings(record=True) as w: - soup = self.soup(markup, parse_only=strainer) + soup = BeautifulSoup(markup, "html5lib", parse_only=strainer) assert soup.decode() == self.document_for(markup) - assert "the html5lib tree builder doesn't support parse_only" in str(w[0].message) + [warning] = w + assert warning.filename == __file__ + assert "the html5lib tree builder doesn't support parse_only" in str(warning.message) def test_correctly_nested_tables(self): """html5lib inserts <tbody> tags where other parsers don't.""" |