summaryrefslogtreecommitdiff
path: root/src/beautifulsoup/tests/test_lxml.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2010-12-29 10:38:46 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2010-12-29 10:38:46 -0500
commit7ba9e49cada146978c1f02d9c28430fdcf56ab72 (patch)
tree77fd6a9d2ab9940569e21e0bcd6b29fed33b03ee /src/beautifulsoup/tests/test_lxml.py
parent017a21625f347665ad23da6dd109b9af29b4b443 (diff)
Refactored the code that turns HTML fragments into parser-specific documents for test purposes.
Diffstat (limited to 'src/beautifulsoup/tests/test_lxml.py')
-rw-r--r--src/beautifulsoup/tests/test_lxml.py20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/beautifulsoup/tests/test_lxml.py b/src/beautifulsoup/tests/test_lxml.py
index bbbbe18..12fd31e 100644
--- a/src/beautifulsoup/tests/test_lxml.py
+++ b/src/beautifulsoup/tests/test_lxml.py
@@ -6,38 +6,26 @@ import unittest
class TestLXMLBuilder(SoupTest):
- def __init__(self, builder):
- super(TestLXMLBuilder, self).__init__()
- self.default_builder = LXMLTreeBuilder()
-
def runTest(self):
self.test_bare_string()
self.test_tag_nesting()
self.test_self_closing()
self.test_soupstrainer()
- def document_for(self, s):
- """Turn a fragment into an HTML document.
-
- lxml does this to HTML fragments it receives, so we need to do it
- if we're going to understand what comes out of lxml.
- """
- return u'<html><body>%s</body></html>' % s
-
def test_bare_string(self):
self.assertSoupEquals(
- "A bare string", self.document_for("<p>A bare string</p>"))
+ "A bare string", "<p>A bare string</p>")
def test_tag_nesting(self):
b_tag = "<b>Inside a B tag</b>"
- self.assertSoupEquals(b_tag, self.document_for(b_tag))
+ self.assertSoupEquals(b_tag)
nested_b_tag = "<p>A <i>nested <b>tag</b></i></p>"
- self.assertSoupEquals(nested_b_tag, self.document_for(nested_b_tag))
+ self.assertSoupEquals(nested_b_tag)
def test_self_closing(self):
self.assertSoupEquals(
- "<p>A <meta> tag</p>", self.document_for("<p>A <meta /> tag</p>"))
+ "<p>A <meta> tag</p>", "<p>A <meta /> tag</p>")
def test_soupstrainer(self):
strainer = SoupStrainer("b")