diff options
Diffstat (limited to 'bitbake/lib/bs4/tests/test_lxml.py')
-rw-r--r-- | bitbake/lib/bs4/tests/test_lxml.py | 19 |
1 files changed, 2 insertions, 17 deletions
diff --git a/bitbake/lib/bs4/tests/test_lxml.py b/bitbake/lib/bs4/tests/test_lxml.py index 2b2e9b7e78..6c2a1d73eb 100644 --- a/bitbake/lib/bs4/tests/test_lxml.py +++ b/bitbake/lib/bs4/tests/test_lxml.py | |||
@@ -7,7 +7,7 @@ try: | |||
7 | import lxml.etree | 7 | import lxml.etree |
8 | LXML_PRESENT = True | 8 | LXML_PRESENT = True |
9 | LXML_VERSION = lxml.etree.LXML_VERSION | 9 | LXML_VERSION = lxml.etree.LXML_VERSION |
10 | except ImportError, e: | 10 | except ImportError as e: |
11 | LXML_PRESENT = False | 11 | LXML_PRESENT = False |
12 | LXML_VERSION = (0,) | 12 | LXML_VERSION = (0,) |
13 | 13 | ||
@@ -62,24 +62,9 @@ class LXMLTreeBuilderSmokeTest(SoupTest, HTMLTreeBuilderSmokeTest): | |||
62 | # if one is installed. | 62 | # if one is installed. |
63 | with warnings.catch_warnings(record=True) as w: | 63 | with warnings.catch_warnings(record=True) as w: |
64 | soup = BeautifulStoneSoup("<b />") | 64 | soup = BeautifulStoneSoup("<b />") |
65 | self.assertEqual(u"<b/>", unicode(soup.b)) | 65 | self.assertEqual("<b/>", str(soup.b)) |
66 | self.assertTrue("BeautifulStoneSoup class is deprecated" in str(w[0].message)) | 66 | self.assertTrue("BeautifulStoneSoup class is deprecated" in str(w[0].message)) |
67 | 67 | ||
68 | def test_real_xhtml_document(self): | ||
69 | """lxml strips the XML definition from an XHTML doc, which is fine.""" | ||
70 | markup = b"""<?xml version="1.0" encoding="utf-8"?> | ||
71 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"> | ||
72 | <html xmlns="http://www.w3.org/1999/xhtml"> | ||
73 | <head><title>Hello.</title></head> | ||
74 | <body>Goodbye.</body> | ||
75 | </html>""" | ||
76 | soup = self.soup(markup) | ||
77 | self.assertEqual( | ||
78 | soup.encode("utf-8").replace(b"\n", b''), | ||
79 | markup.replace(b'\n', b'').replace( | ||
80 | b'<?xml version="1.0" encoding="utf-8"?>', b'')) | ||
81 | |||
82 | |||
83 | @skipIf( | 68 | @skipIf( |
84 | not LXML_PRESENT, | 69 | not LXML_PRESENT, |
85 | "lxml seems not to be present, not testing its XML tree builder.") | 70 | "lxml seems not to be present, not testing its XML tree builder.") |