diff options
author | Leonard Richardson <leonardr@segfault.org> | 2013-05-07 09:40:47 -0400 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2013-05-07 09:40:47 -0400 |
commit | 457fa9096e5cee673063b41d58da9f2442814f0f (patch) | |
tree | a5bfd05b0d7e4caa2f0cce2bd7a63725057f3bd8 /bs4/tests/test_lxml.py | |
parent | 4a0f656752dc2de3f3451397e09e806ad2874ea1 (diff) | |
parent | 5b3860ec348b66976de64b5be407704041102869 (diff) |
Merged.
Diffstat (limited to 'bs4/tests/test_lxml.py')
-rw-r--r-- | bs4/tests/test_lxml.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/bs4/tests/test_lxml.py b/bs4/tests/test_lxml.py index 39e26bf..f32fc2b 100644 --- a/bs4/tests/test_lxml.py +++ b/bs4/tests/test_lxml.py @@ -6,6 +6,8 @@ import warnings try: from bs4.builder import LXMLTreeBuilder, LXMLTreeBuilderForXML LXML_PRESENT = True + import lxml.etree + LXML_VERSION = lxml.etree.LXML_VERSION except ImportError, e: LXML_PRESENT = False @@ -41,6 +43,17 @@ class LXMLTreeBuilderSmokeTest(SoupTest, HTMLTreeBuilderSmokeTest): self.assertSoupEquals( "<p>foo�bar</p>", "<p>foobar</p>") + # In lxml < 2.3.5, an empty doctype causes a segfault. Skip this + # test if an old version of lxml is installed. + + @skipIf( + LXML_VERSION < (2,3,5,0), + "Skipping doctype test for old version of lxml to avoid segfault.") + def test_empty_doctype(self): + soup = self.soup("<!DOCTYPE>") + doctype = soup.contents[0] + self.assertEqual("", doctype.strip()) + def test_beautifulstonesoup_is_xml_parser(self): # Make sure that the deprecated BSS class uses an xml builder # if one is installed. |