summaryrefslogtreecommitdiff
path: root/src/beautifulsoup/tests/helpers.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2010-12-29 18:34:23 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2010-12-29 18:34:23 -0500
commit3e79613458960499d2bce45d4db0d0e96d8e2ffe (patch)
treee79a31852af92f602f94dd81ff27ed3eea2fd35d /src/beautifulsoup/tests/helpers.py
parent234bedc1b51af8fce66ff4fbe381d94a08b9509b (diff)
Wrangled some encoding conversion tests out of the old test file.
Diffstat (limited to 'src/beautifulsoup/tests/helpers.py')
-rw-r--r--src/beautifulsoup/tests/helpers.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/beautifulsoup/tests/helpers.py b/src/beautifulsoup/tests/helpers.py
index 42ec3ec..c62bb48 100644
--- a/src/beautifulsoup/tests/helpers.py
+++ b/src/beautifulsoup/tests/helpers.py
@@ -13,9 +13,16 @@ class SoupTest(unittest.TestCase):
# test suites that override default_builder.
self.default_builder = LXMLTreeBuilder()
- def soup(self, markup):
+ def soup(self, markup, **kwargs):
"""Build a Beautiful Soup object from markup."""
- return BeautifulSoup(markup, builder=self.default_builder)
+ return BeautifulSoup(markup, builder=self.default_builder, **kwargs)
+
+ def document_for(self, markup):
+ """Turn an HTML fragment into a document.
+
+ The details depend on the builder.
+ """
+ return self.default_builder.test_fragment_to_document(markup)
def assertSoupEquals(self, to_parse, compare_parsed_to=None):
builder = self.default_builder
@@ -23,9 +30,7 @@ class SoupTest(unittest.TestCase):
if compare_parsed_to is None:
compare_parsed_to = to_parse
- self.assertEquals(
- obj.decode(),
- builder.test_fragment_to_document(compare_parsed_to))
+ self.assertEquals(obj.decode(), self.document_for(compare_parsed_to))