Ejemplo n.º 1
0
 def test_xpathselector(self):
     with warnings.catch_warnings(record=True):
         hs = XPathSelector(text=self.text)
         self.assertEqual(
             hs.select("//div").extract(),
             [u'<div><img src="a.jpg"><p>Hello</p></div>'])
         self.assertRaises(RuntimeError, hs.css, 'div')
Ejemplo n.º 2
0
 def test_xpathselector(self):
     with warnings.catch_warnings():
         warnings.simplefilter('ignore', ScrapyDeprecationWarning)
         hs = XPathSelector(text=self.text)
         self.assertEqual(hs.select("//div").extract(),
                          [u'<div><img src="a.jpg"><p>Hello</p></div>'])
         self.assertRaises(RuntimeError, hs.css, 'div')
Ejemplo n.º 3
0
 def test_xpathselector(self):
     with warnings.catch_warnings():
         warnings.simplefilter('ignore', ScrapyDeprecationWarning)
         hs = XPathSelector(text=self.text)
         self.assertEqual(
             hs.select("//div").extract(),
             [u'<div><img src="a.jpg"><p>Hello</p></div>'])
         self.assertRaises(RuntimeError, hs.css, 'div')
Ejemplo n.º 4
0
 def test_xpathselector(self):
     with warnings.catch_warnings(record=True):
         hs = XPathSelector(text=self.text)
         self.assertEqual(hs.select("//div").extract(),
                          [u'<div><img src="a.jpg"><p>Hello</p></div>'])
         self.assertRaises(RuntimeError, hs.css, 'div')