PY3: port scrapy/utils/gz.py

This commit is contained in:
Daniel Graña 2014-08-01 02:25:33 -03:00
parent 910d0d36c1
commit c564334d00
2 changed files with 4 additions and 4 deletions

View File

@ -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

View File

@ -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>')