summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--beautifulsoup/builder/__init__.py7
-rw-r--r--tests/test_lxml.py18
2 files changed, 17 insertions, 8 deletions
diff --git a/beautifulsoup/builder/__init__.py b/beautifulsoup/builder/__init__.py
index d6c750c..2e8846b 100644
--- a/beautifulsoup/builder/__init__.py
+++ b/beautifulsoup/builder/__init__.py
@@ -163,5 +163,12 @@ class HTMLTreeBuilder(TreeBuilder):
pass
return False
+
+def register_builders_from(module, add_to_all):
+ __import__(module.__name__, module.__all__)
+ add_to_all += module.__all__
+
from _lxml import *
+register_builders_from(_lxml, __all__)
from _html5lib import *
+register_builders_from(_html5lib, __all__)
diff --git a/tests/test_lxml.py b/tests/test_lxml.py
index de2ce7b..9d08aef 100644
--- a/tests/test_lxml.py
+++ b/tests/test_lxml.py
@@ -9,14 +9,16 @@ from beautifulsoup.testing import SoupTest
class TestLXMLBuilder(SoupTest):
- """A smoke test for the LXML tree builders.
-
- Subclass this to test some other tree builder. Subclasses of this
- test ensure that all of Beautiful Soup's tree builders generate
- more or less the same trees. It's okay for trees to differ--just
- override the appropriate test method to demonstrate how one tree
- builder differs from the LXML builder. But in general, all tree
- builders should generate trees that make most of these tests pass.
+ """A smoke test for the LXML tree builder.
+
+ Subclass this to test some other HTML tree builder. Subclasses of
+ this test ensure that all of Beautiful Soup's tree builders
+ generate more or less the same trees.
+
+ It's okay for trees to differ--just override the appropriate test
+ method to demonstrate how one tree builder differs from the LXML
+ builder. But in general, all HTML tree builders should generate
+ trees that make most of these tests pass.
"""
def test_bare_string(self):