Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(2)  |  Call(2)  |  Derive(0)  |  Import(0)

src/d/r/dragnet-HEAD/test/test_blocks.py   dragnet(Download)
    def test_text_from_subtree(self):
        from lxml import etree
        s = """<a href=".">WILL <img src="."> THIS PASS <b>THE TEST</b> ??</a>"""
        tree = etree.fromstring(s, etree.HTMLParser(recover=True))
        text_list = blocks.text_from_subtree(tree)
        s = '<div>\x92</div>'
        tree = etree.fromstring(s, etree.HTMLParser(recover=True, encoding='utf-8'))
        text_list = blocks.text_from_subtree(tree)
        text_str = ' '.join([ele.strip() for ele in text_list if ele.strip() != ''])
        self.assertEqual(text_str, '')