From 064439f3b2decfb55b4e118ac4d41851d13c4c6f Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Tue, 13 Aug 2013 10:44:46 -0400 Subject: * Fixed yet another problem with the html5lib tree builder, caused by html5lib's tendency to rearrange the tree during parsing. [bug=1189267] --- bs4/tests/test_html5lib.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'bs4/tests/test_html5lib.py') diff --git a/bs4/tests/test_html5lib.py b/bs4/tests/test_html5lib.py index 2a3b41e..594c3e1 100644 --- a/bs4/tests/test_html5lib.py +++ b/bs4/tests/test_html5lib.py @@ -70,3 +70,16 @@ class HTML5LibBuilderSmokeTest(SoupTest, HTML5TreeBuilderSmokeTest): soup = self.soup(markup) # Verify that we can reach the

tag; this means the tree is connected. self.assertEqual(b"

foo

", soup.p.encode()) + + def test_reparented_markup(self): + markup = '

foo

\n

bar

' + soup = self.soup(markup) + self.assertEqual(u"

foo

\n

bar

", soup.body.decode()) + self.assertEqual(2, len(soup.find_all('p'))) + + + def test_reparented_markup_ends_with_whitespace(self): + markup = '

foo

\n

bar

\n' + soup = self.soup(markup) + self.assertEqual(u"

foo

\n

bar

\n", soup.body.decode()) + self.assertEqual(2, len(soup.find_all('p'))) -- cgit v1.2.3