Skip to content

Commit 0db4967

Browse files
committed
Fix some small errors
1 parent 493b4b5 commit 0db4967

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/isal/igzip.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
from . import isal_zlib
3333

34-
__all__ = ["IGzipFile", "open", "compress", "decompress"]
34+
__all__ = ["IGzipFile", "open", "compress", "decompress", "BadGzipFile"]
3535

3636
_COMPRESS_LEVEL_FAST = isal_zlib.ISAL_BEST_SPEED
3737
_COMPRESS_LEVEL_TRADEOFF = isal_zlib.ISAL_DEFAULT_COMPRESSION
@@ -40,6 +40,9 @@
4040

4141
BUFFER_SIZE = _compression.BUFFER_SIZE
4242

43+
class BadGzipFile(OSError):
44+
pass
45+
4346

4447
# The open method was copied from the python source with minor adjustments.
4548
def open(filename, mode="rb", compresslevel=_COMPRESS_LEVEL_TRADEOFF,

tests/test_gzip_compliance.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ def test_zero_padded_file(self):
456456
def test_igzip_BadGzipFile_exception(self):
457457
self.assertTrue(issubclass(igzip.BadGzipFile, OSError))
458458

459-
def test_bad_igzip_file(self):
459+
def test_bad_gzip_file(self):
460460
with open(self.filename, 'wb') as file:
461461
file.write(data1 * 50)
462462
with igzip.IGzipFile(self.filename, 'r') as file:
@@ -555,7 +555,7 @@ def test_bytes_filename(self):
555555

556556
def test_decompress_limited(self):
557557
"""Decompressed data buffering should be limited"""
558-
bomb = igzip.compress(b'\0' * int(2e6), compresslevel=9)
558+
bomb = igzip.compress(b'\0' * int(2e6), compresslevel=3)
559559
self.assertLess(len(bomb), io.DEFAULT_BUFFER_SIZE)
560560

561561
bomb = io.BytesIO(bomb)
@@ -569,7 +569,7 @@ def test_decompress_limited(self):
569569

570570
def test_compress(self):
571571
for data in [data1, data2]:
572-
for args in [(), (1,), (6,), (9,)]:
572+
for args in [(), (1,), (2,), (3,), (0,)]:
573573
datac = igzip.compress(data, *args)
574574
self.assertEqual(type(datac), bytes)
575575
with igzip.IGzipFile(fileobj=io.BytesIO(datac), mode="rb") as f:

0 commit comments

Comments
 (0)