def test_as_string(self): input_tree = html.fromstring('<p>Foo') doc = HTMLFeatureInfoDoc(input_tree) assert b'<body><p>Foo</p></body>' in strip_whitespace(doc.as_string())