Skip to content

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

PY3: port scrapy/utils/gz.py

Daniel Grañac564334d00fa
diff --git a/tests/py3-ignores.txt b/tests/py3-ignores.txt
index 868264b85..5905eaa55 100644
--- a/tests/py3-ignores.txt
+++ b/tests/py3-ignores.txt
@@ -64,7 +64,6 @@ tests/test_squeue.py
tests/test_stats.py
tests/test_toplevel.py
tests/test_utils_defer.py
-tests/test_utils_gz.py
tests/test_utils_httpobj.py
tests/test_utils_iterators.py
tests/test_utils_jsonrpc.py
diff --git a/tests/test_utils_gz.py b/tests/test_utils_gz.py
index 7250a870e..94e7b71be 100644
--- a/tests/test_utils_gz.py
+++ b/tests/test_utils_gz.py
@@ -1,11 +1,12 @@
import unittest
from os.path import join
-from tests import tests_datadir
from scrapy.utils.gz import gunzip
+from tests import tests_datadir
SAMPLEDIR = join(tests_datadir, 'compressed')
+
class GzTest(unittest.TestCase):
def test_gunzip_basic(self):
@@ -16,7 +17,7 @@ class GzTest(unittest.TestCase):
def test_gunzip_truncated(self):
with open(join(SAMPLEDIR, 'truncated-crc-error.gz'), 'rb') as f:
text = gunzip(f.read())
- assert text.endswith('</html')
+ assert text.endswith(b'</html')
def test_gunzip_no_gzip_file_raises(self):
with open(join(SAMPLEDIR, 'feed-sample1.xml'), 'rb') as f:
@@ -25,4 +26,4 @@ class GzTest(unittest.TestCase):
def test_gunzip_truncated_short(self):
with open(join(SAMPLEDIR, 'truncated-crc-error-short.gz'), 'rb') as f:
text = gunzip(f.read())
- assert text.endswith('</html>')
+ assert text.endswith(b'</html>')