summaryrefslogtreecommitdiff
path: root/bs4/testing.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2019-07-07 15:59:09 -0400
committerLeonard Richardson <leonardr@segfault.org>2019-07-07 15:59:09 -0400
commit0159c0a4135f267aed0586ba9d829d0a3da25da8 (patch)
tree78f20c40c74910109651bb7fb0a1b6dc1a29a621 /bs4/testing.py
parent0c3c1970dcb93bbe591707e43cfba9b24de45d05 (diff)
It's now possible to override a TreeBuilder's cdata_list_attributes dictionary by passing in a replacement. None will disable the feature altogether. [bug=1832978]
Diffstat (limited to 'bs4/testing.py')
-rw-r--r--bs4/testing.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/bs4/testing.py b/bs4/testing.py
index e4a0ffe..e144e7e 100644
--- a/bs4/testing.py
+++ b/bs4/testing.py
@@ -63,19 +63,19 @@ class SoupTest(unittest.TestCase):
@property
def default_builder(self):
- return default_builder()
+ return default_builder
def soup(self, markup, **kwargs):
"""Build a Beautiful Soup object from markup."""
builder = kwargs.pop('builder', self.default_builder)
return BeautifulSoup(markup, builder=builder, **kwargs)
- def document_for(self, markup):
+ def document_for(self, markup, **kwargs):
"""Turn an HTML fragment into a document.
The details depend on the builder.
"""
- return self.default_builder.test_fragment_to_document(markup)
+ return self.default_builder(**kwargs).test_fragment_to_document(markup)
def assertSoupEquals(self, to_parse, compare_parsed_to=None):
builder = self.default_builder
@@ -232,7 +232,7 @@ class HTMLTreeBuilderSmokeTest(object):
soup = self.soup("")
new_tag = soup.new_tag(name)
self.assertEqual(True, new_tag.is_empty_element)
-
+
def test_pickle_and_unpickle_identity(self):
# Pickling a tree, then unpickling it, yields a tree identical
# to the original.