Skip to content

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

PY3 fix AjacCrawlable middleware tests

Mikhail Korobov45101829a52d
diff --git a/tests/py3-ignores.txt b/tests/py3-ignores.txt
index 759eeffff..7d077adcb 100644
--- a/tests/py3-ignores.txt
+++ b/tests/py3-ignores.txt
@@ -6,7 +6,6 @@ tests/test_exporters.py
tests/test_linkextractors_deprecated.py
tests/test_crawl.py
tests/test_downloader_handlers.py
-tests/test_downloadermiddleware_ajaxcrawlable.py
tests/test_downloadermiddleware_defaultheaders.py
tests/test_downloadermiddleware_downloadtimeout.py
tests/test_downloadermiddleware_httpauth.py
diff --git a/tests/test_downloadermiddleware_ajaxcrawlable.py b/tests/test_downloadermiddleware_ajaxcrawlable.py
index 67c57778d..493691ea4 100644
--- a/tests/test_downloadermiddleware_ajaxcrawlable.py
+++ b/tests/test_downloadermiddleware_ajaxcrawlable.py
@@ -14,7 +14,7 @@ class AjaxCrawlMiddlewareTest(unittest.TestCase):
self.mw = AjaxCrawlMiddleware.from_crawler(crawler)
def _ajaxcrawlable_body(self):
- return '<html><head><meta name="fragment" content="!"/></head><body></body></html>'
+ return b'<html><head><meta name="fragment" content="!"/></head><body></body></html>'
def _req_resp(self, url, req_kwargs=None, resp_kwargs=None):
req = Request(url, **(req_kwargs or {}))
@@ -53,6 +53,6 @@ class AjaxCrawlMiddlewareTest(unittest.TestCase):
assert resp3 is resp2
def test_noncrawlable_body(self):
- req, resp = self._req_resp('http://example.com/', {}, {'body': '<html></html>'})
+ req, resp = self._req_resp('http://example.com/', {}, {'body': b'<html></html>'})
resp2 = self.mw.process_response(req, resp, self.spider)
self.assertIs(resp, resp2)