test that default start_request return value type is a generator. refs #98

This commit is contained in:
Daniel Graña 2012-03-05 17:49:57 -02:00
parent 45685ea6cd
commit 2909a60e95
1 changed files with 7 additions and 1 deletions

View File

@ -1,4 +1,4 @@
import gzip, warnings
import gzip, warnings, inspect
from cStringIO import StringIO
from twisted.trial import unittest
@ -24,6 +24,12 @@ class BaseSpiderTest(unittest.TestCase):
self.assertEqual(spider.name, 'example.com')
self.assertEqual(spider.start_urls, [])
def test_start_requests(self):
spider = self.spider_class('example.com')
start_requests = spider.start_requests()
self.assertTrue(inspect.isgenerator(start_requests))
self.assertEqual(list(start_requests), [])
def test_spider_args(self):
"""Constructor arguments are assigned to spider attributes"""
spider = self.spider_class('example.com', foo='bar')