Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

added additional test to ResponseSoup extension

Pablo Hoffman3f13b388c711
diff --git a/scrapy/trunk/scrapy/tests/test_contrib_response_soup.py b/scrapy/trunk/scrapy/tests/test_contrib_response_soup.py
index 82c291038..c07b26873 100644
--- a/scrapy/trunk/scrapy/tests/test_contrib_response_soup.py
+++ b/scrapy/trunk/scrapy/tests/test_contrib_response_soup.py
@@ -21,6 +21,11 @@ class ResponseSoupTest(unittest.TestCase):
# make sure it's cached
assert soup1 is soup2
+ # when body is None, an empty soup should be returned
+ r1 = Response('http://www.example.com')
+ assert r1.body is None
+ assert isinstance(r1.getsoup(), BeautifulSoup)
+
def test_response_soup_caching(self):
r1 = Response('http://www.example.com', body='')
soup1 = r1.getsoup()