diff --git a/.gitmodules b/.gitmodules index c0d2229..604bd56 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "zlib"] path = zlib - url = https://github.com/madler/zlib.git + url = https://github.com/cielavenir/zlib.git diff --git a/tests/test_deflate64.py b/tests/test_deflate64.py index 92e1f6f..f7dc676 100644 --- a/tests/test_deflate64.py +++ b/tests/test_deflate64.py @@ -38,15 +38,18 @@ def test_decompress_output_type(data_dir, deflate64): def test_decompress_repeated(data_dir, deflate64): - """Ensure that resources are properly shared by repeated invocations of Deflate64.decompress.""" - with open(data_dir / '10_lines.deflate64', 'rb') as compressed_content_stream: - decompressed_content_10 = deflate64.decompress(compressed_content_stream.read()) - - with open(data_dir / '100_lines.deflate64', 'rb') as compressed_content_stream: - decompressed_content_100 = deflate64.decompress(compressed_content_stream.read()) - - assert len(decompressed_content_10) == 180 - assert len(decompressed_content_100) == 1890 + """Ensure that Deflate64.decompress can be called repeatedly on a compressed stream.""" + read_size = 64 * 2 ** 10 + decompressed_content = b'' + with open(data_dir / '100k_lines.deflate64', 'rb') as compressed_content_stream: + while True: + compressed_content = compressed_content_stream.read(read_size) + if not compressed_content: + break + decompressed_content += deflate64.decompress(compressed_content) + + assert len(decompressed_content) == 2188890 + assert re.match(rb'^(?:Sample content \d+\.\n)+$', decompressed_content) def test_decompress_empty(deflate64): diff --git a/tests/test_zipfile.py b/tests/test_zipfile.py index 7e21598..326e7c0 100644 --- a/tests/test_zipfile.py +++ b/tests/test_zipfile.py @@ -35,13 +35,11 @@ def test_zipfile_compress_type(zip_file): assert zip_ext_file.compress_type == zipfile.ZIP_DEFLATED64 -@pytest.mark.xfail(raises=ValueError) def test_zipfile_extract(tmp_path, zip_file, file_name): zip_file.extract(file_name, path=tmp_path) assert (tmp_path / file_name).exists() -@pytest.mark.xfail(raises=ValueError) def test_zipfile_extractall(tmp_path, zip_file): zip_file.extractall(path=tmp_path) assert len(list(tmp_path.iterdir())) == 4 @@ -62,7 +60,6 @@ def test_zipfile_read_short(zip_ext_file): assert decompressed_content == b'Sample content 0.\n' -@pytest.mark.xfail(raises=ValueError) def test_zipfile_readline_repeated(zip_ext_file): while True: decompressed_content = zip_ext_file.readline() diff --git a/zlib b/zlib index cacf7f1..beaec8d 160000 --- a/zlib +++ b/zlib @@ -1 +1 @@ -Subproject commit cacf7f1d4e3d44d871b605da3b647f07d718623f +Subproject commit beaec8dc39f5caa86e808611b10f2ea0ab8720c2