def test_lxml(self): from calibre.utils.cleantext import test_clean_xml_chars test_clean_xml_chars() from lxml import etree raw = '<a/>' root = etree.fromstring(raw) self.assertEqual(etree.tostring(root), raw)
def test_lxml(self): from calibre.utils.cleantext import test_clean_xml_chars test_clean_xml_chars() from lxml import etree raw = b'<a/>' root = etree.fromstring(raw, parser=etree.XMLParser(recover=True, no_network=True, resolve_entities=False)) self.assertEqual(etree.tostring(root), raw)
def test_lxml(): from calibre.utils.cleantext import test_clean_xml_chars test_clean_xml_chars() from lxml import etree raw = '<a/>' root = etree.fromstring(raw) if etree.tostring(root) == raw: fprint('lxml OK!') else: raise RuntimeError('lxml failed')