示例#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')
示例#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')
示例#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')
示例#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')