From f93d5bf81e56515098785068a18f2befec37857a Mon Sep 17 00:00:00 2001 From: Leonard Richardson Date: Sun, 13 Feb 2011 21:42:50 -0500 Subject: Ported more tests of bad declarations. --- tests/test_html5lib.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/test_html5lib.py') diff --git a/tests/test_html5lib.py b/tests/test_html5lib.py index 48f27ae..3efdebf 100644 --- a/tests/test_html5lib.py +++ b/tests/test_html5lib.py @@ -107,6 +107,28 @@ class TestHTML5BuilderInvalidMarkup(TestLXMLBuilderInvalidMarkup): ("

a

" "")) + def test_whitespace_in_doctype(self): + # A declaration that has extra whitespace is turned into a comment. + soup = self.soup(( + '' + '

foo

')) + self.assertEquals( + str(soup), + ('' + '

foo

')) + + def test_incomplete_declaration(self): + # An incomplete declaration is treated as a comment. + markup = 'ac' + self.assertSoupEquals(markup, "ac") + + # Let's spell that out a little more explicitly. + soup = self.soup(markup) + str1, comment, str2 = soup.body.contents + self.assertEquals(str1, 'a') + self.assertEquals(comment.__class__, Comment) + self.assertEquals(comment, 'b Sacr\xe9 bleu!""" -- cgit v1.2.3