def test_document_ends_with_incomplete_declaration(self):
soup = self.soup('<p>a<!b')
# This becomes a string 'a'. The incomplete declaration is ignored.
# Compare html5lib, which turns it into a comment.
s, comment = soup.p.contents
self.assertEqual(s, 'a')
self.assertTrue(isinstance(comment, Comment))
self.assertEqual(comment, 'b')
评论列表
文章目录