def test_body(self): html = '''<body><p>test</p></body>''' res = b'''<html><body><p>test</p></body></html>''' tree = self.soupparser.fromstring(html) self.assertEqual(tostring(tree), res)