mirror of https://github.com/scrapy/scrapy.git
Added test for NotImplemented Spider.parse method
This commit is contained in:
parent
be71f98e92
commit
7adab61a7a
|
|
@ -429,3 +429,17 @@ class DeprecationTest(unittest.TestCase):
|
|||
self.assertEqual(len(requests), 1)
|
||||
self.assertEqual(requests[0].url, 'http://example.com/foo')
|
||||
self.assertEqual(len(w), 1)
|
||||
|
||||
|
||||
class NoParseMethodSpiderTest(unittest.TestCase):
|
||||
|
||||
spider_class = Spider
|
||||
|
||||
def test_undefined_parse_method(self):
|
||||
spider = self.spider_class('example.com')
|
||||
text = 'Random text response'
|
||||
resp = TextResponse(url="http://www.example.com/random_url", body=text)
|
||||
|
||||
exc_msg = 'Spider.parse callback is not defined'
|
||||
with self.assertRaisesRegexp(NotImplementedError, exc_msg):
|
||||
spider.parse(resp)
|
||||
|
|
|
|||
Loading…
Reference in New Issue