def test_leadingTextDropping(self):
        """
        Make sure that if there's no top-level node lenient-mode won't
        drop leading text that's outside of any elements.
        """
        s = "Hi orders! <br>Well. <br>"
        d = microdom.parseString(s, beExtremelyLenient=True)
        self.assertEqual(d.firstChild().toxml(),
                          '<html>Hi orders! <br />Well. <br /></html>')
        byteStream = BytesIO()
        d.firstChild().writexml(byteStream, '', '', '', '', {}, '')
        self.assertEqual(byteStream.getvalue(),
                         b'<html>Hi orders! <br />Well. <br /></html>')

        Make sure that if there's no top-level node lenient-mode won't
        drop leading text that's outside of any elements.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/web/test/test_xml.py