diff options
Diffstat (limited to 'bs4/tests/test_lxml.py')
-rw-r--r-- | bs4/tests/test_lxml.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/bs4/tests/test_lxml.py b/bs4/tests/test_lxml.py index 27ec570..4e0b12e 100644 --- a/bs4/tests/test_lxml.py +++ b/bs4/tests/test_lxml.py @@ -1,6 +1,7 @@ """Tests to ensure that the lxml tree builder generates good trees.""" import re +import warnings try: from bs4.builder import LXMLTreeBuilder, LXMLTreeBuilderForXML @@ -8,7 +9,10 @@ try: except ImportError, e: LXML_PRESENT = False -from bs4 import BeautifulSoup +from bs4 import ( + BeautifulSoup, + BeautifulStoneSoup, + ) from bs4.element import Comment, Doctype, SoupStrainer from bs4.testing import skipIf from bs4.tests import test_htmlparser @@ -37,6 +41,13 @@ class LXMLTreeBuilderSmokeTest(SoupTest, HTMLTreeBuilderSmokeTest): self.assertSoupEquals( "<p>foo�bar</p>", "<p>foobar</p>") + def test_beautifulstonesoup_is_xml_parser(self): + # Make sure that the deprecated BSS class uses an xml builder + # if one is installed. + with warnings.catch_warnings(record=False) as w: + soup = BeautifulStoneSoup("<b />") + self.assertEqual(u"<b/>", unicode(soup.b)) + @skipIf( not LXML_PRESENT, "lxml seems not to be present, not testing its XML tree builder.") |