summaryrefslogtreecommitdiff
path: root/bs4/tests/test_html5lib.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonard.richardson@canonical.com>2012-02-15 12:06:50 -0500
committerLeonard Richardson <leonard.richardson@canonical.com>2012-02-15 12:06:50 -0500
commit0f6d3cfbef6fc0b90f0e9fbe58408e00c2383070 (patch)
treedbf03213f941021448c1a853d8aa81617cd438d8 /bs4/tests/test_html5lib.py
parent15f9dc784c352f2928c19460107095651f6fb624 (diff)
parent8cd893c5094e96c7bcdaa735356f4d803210ef34 (diff)
Fixed up html5lib tree builder.
Diffstat (limited to 'bs4/tests/test_html5lib.py')
-rw-r--r--bs4/tests/test_html5lib.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/bs4/tests/test_html5lib.py b/bs4/tests/test_html5lib.py
index 5b1d1e4..dcbd204 100644
--- a/bs4/tests/test_html5lib.py
+++ b/bs4/tests/test_html5lib.py
@@ -104,12 +104,38 @@ class TestHTML5BuilderInvalidMarkup(TestLXMLBuilderInvalidMarkup):
self.assertSoupEquals("<table><div>Foo</div></table>",
"<div>Foo</div><table></table>")
+ def test_unclosed_a_tag(self):
+ # n.b. the whitespace is important here.
+ markup = """<div id="1">
+ <a href="foo">
+</div>
+<div id="2">
+ <div id="3">
+ <a href="bar"></a>
+ </div>
+</div>"""
+
+ expect = """<div id="1">
+ <a href="foo">
+</a></div><a href="foo">
+</a><div id="2"><a href="foo">
+ </a><div id="3"><a href="foo">
+ </a><a href="bar"></a>
+ </div>
+</div>"""
+ self.assertSoupEquals(markup, expect)
+
def test_incorrectly_nested_tables(self):
self.assertSoupEquals(
'<table><tr><table><tr id="nested">',
('<table><tbody><tr></tr></tbody></table>'
'<table><tbody><tr id="nested"></tr></tbody></table>'))
+ def test_floating_text_in_table(self):
+ self.assertSoupEquals(
+ "<table><td></td>foo<td>bar</td></table>",
+ "foo<table><tbody><tr><td></td><td>bar</td></tr></tbody></table>")
+
def test_empty_element_tag_with_contents(self):
self.assertSoupEquals("<br>foo</br>", "<br />foo<br />")