diff options
author | Leonard Richardson <leonard.richardson@canonical.com> | 2012-03-01 17:39:55 -0500 |
---|---|---|
committer | Leonard Richardson <leonard.richardson@canonical.com> | 2012-03-01 17:39:55 -0500 |
commit | 8333c2b5bfd78dfcc9544403a6e1d285f587475b (patch) | |
tree | 2bc9399b5a9a544cc0e5561516542365c4061c6e /bs4/tests/test_lxml.py | |
parent | ad95318eb882a55a7a4bb692defdce8dee487cb6 (diff) |
For backwards compatibility, brought back the BeautifulStoneSoup class as a deprecated wrapper around BeautifulSoup.
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.") |