Skip to content

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

add a check that byte url is not accepted in http.Response on py3

Konstantin Lopuhin96fcf4cea41a
diff --git a/tests/test_http_response.py b/tests/test_http_response.py
index b49d46ea8..710a5b29d 100644
--- a/tests/test_http_response.py
+++ b/tests/test_http_response.py
@@ -17,6 +17,8 @@ class BaseResponseTest(unittest.TestCase):
# Response requires url in the consturctor
self.assertRaises(Exception, self.response_class)
self.assertTrue(isinstance(self.response_class('http://example.com/'), self.response_class))
+ if not six.PY2:
+ self.assertRaises(TypeError, self.response_class, b"http://example.com")
# body can be str or None
self.assertTrue(isinstance(self.response_class('http://example.com/', body=b''), self.response_class))
self.assertTrue(isinstance(self.response_class('http://example.com/', body=b'body'), self.response_class))