summaryrefslogtreecommitdiff
path: root/tests/test_lxml.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2011-02-19 21:21:14 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2011-02-19 21:21:14 -0500
commit22e7fc268c6150f812e9af55f28dba7aeda4d053 (patch)
tree766662556ae441c5474e754fe9d582ffce3ff257 /tests/test_lxml.py
parent8249b803d9bab9c06be02a244e629cb732f4f5b1 (diff)
parent9a936b48fe05666780662c76d5df3b3de7b48074 (diff)
Preliminary work for getting XML parsing to work.
Diffstat (limited to 'tests/test_lxml.py')
-rw-r--r--tests/test_lxml.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/tests/test_lxml.py b/tests/test_lxml.py
index 7e15dcf..8670806 100644
--- a/tests/test_lxml.py
+++ b/tests/test_lxml.py
@@ -126,12 +126,11 @@ class TestLXMLBuilder(SoupTest):
def test_literal_in_textarea(self):
# Anything inside a <textarea> is supposed to be treated as
- # the literal value of the field, (XXX citation needed).
- #
- # But, both lxml and html5lib do their best to parse the
- # contents of a <textarea> as HTML.
+ # the literal value of the field, (XXX citation
+ # needed). html5lib does this correctly. But, lxml does its
+ # best to parse the contents of a <textarea> as HTML.
text = '<textarea>Junk like <b> tags and <&<&amp;</textarea>'
- soup = BeautifulSoup(text)
+ soup = self.soup(text)
self.assertEquals(len(soup.textarea.contents), 2)
self.assertEquals(soup.textarea.contents[0], u"Junk like ")
self.assertEquals(soup.textarea.contents[1].name, 'b')
@@ -141,7 +140,7 @@ class TestLXMLBuilder(SoupTest):
# The contents of a <script> tag are treated as a literal string,
# even if that string contains HTML.
javascript = 'if (i < 2) { alert("<b>foo</b>"); }'
- soup = BeautifulSoup('<script>%s</script>' % javascript)
+ soup = self.soup('<script>%s</script>' % javascript)
self.assertEquals(soup.script.string, javascript)
def test_naked_ampersands(self):
@@ -300,7 +299,7 @@ class TestLXMLBuilder(SoupTest):
def test_entities_converted_on_the_way_out(self):
text = "<p>&lt;&lt;sacr&eacute;&#32;bleu!&gt;&gt;</p>"
expected = u"&lt;&lt;sacr\N{LATIN SMALL LETTER E WITH ACUTE} bleu!&gt;&gt;".encode("utf-8")
- soup = BeautifulSoup(text)
+ soup = self.soup(text)
str = soup.p.string
#self.assertEquals(str.encode("utf-8"), expected)