From 7ba9e49cada146978c1f02d9c28430fdcf56ab72 Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Wed, 29 Dec 2010 10:38:46 -0500 Subject: Refactored the code that turns HTML fragments into parser-specific documents for test purposes. --- src/beautifulsoup/tests/test_lxml.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src/beautifulsoup/tests/test_lxml.py') 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'%s' % s - def test_bare_string(self): self.assertSoupEquals( - "A bare string", self.document_for("

A bare string

")) + "A bare string", "

A bare string

") def test_tag_nesting(self): b_tag = "Inside a B tag" - self.assertSoupEquals(b_tag, self.document_for(b_tag)) + self.assertSoupEquals(b_tag) nested_b_tag = "

A nested tag

" - self.assertSoupEquals(nested_b_tag, self.document_for(nested_b_tag)) + self.assertSoupEquals(nested_b_tag) def test_self_closing(self): self.assertSoupEquals( - "

A tag

", self.document_for("

A tag

")) + "

A tag

", "

A tag

") def test_soupstrainer(self): strainer = SoupStrainer("b") -- cgit v1.2.3