Skip to content

Commit

Permalink
Merge pull request #26 from brianhelba/resumeable
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhelba committed Jan 5, 2022
2 parents 566046c + fa7f595 commit beec331
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "zlib"]
path = zlib
url = https://github.com/madler/zlib.git
url = https://github.com/cielavenir/zlib.git
21 changes: 12 additions & 9 deletions tests/test_deflate64.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 0 additions & 3 deletions tests/test_zipfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion zlib
Submodule zlib updated from cacf7f to beaec8

0 comments on commit beec331

Please sign in to comment.