Exemplo n.º 1
0
    def test_lxml_tree_realdata(self):
        import lxml.etree

        with open('crawler/data/awesome_python.html', 'rb') as inp:
            data = inp.read()
        res = Response(body=data, url=None)
        self.assertTrue(isinstance(res._lxml_tree(), lxml.etree._ElementTree))
Exemplo n.º 2
0
 def test_lxml_tree_empty_body(self):
     res = Response(body=b'', url=None)
     res._lxml_tree()
Exemplo n.º 3
0
 def test_lxml_tree_only_comment(self):
     res = Response(body=b'<-- foo -->', url=None)
     res._lxml_tree()