Skip to content

Commit 5d74323

Browse files
committed
Make decompress limited test work with actual READ_BUFFER_SIZE value
1 parent 49e3112 commit 5d74323

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/test_gzip_compliance.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -572,13 +572,15 @@ def test_bytes_filename(self):
572572

573573
def test_decompress_limited(self):
574574
"""Decompressed data buffering should be limited"""
575-
bomb = igzip.compress(b'\0' * int(2e6), compresslevel=3)
576-
self.assertLess(len(bomb), io.DEFAULT_BUFFER_SIZE)
575+
bomb_size = int(2e6)
576+
self.assertLess(igzip.READ_BUFFER_SIZE, bomb_size)
577+
bomb = gzip.compress(b'\0' * bomb_size, compresslevel=9)
578+
self.assertLess(len(bomb), igzip.READ_BUFFER_SIZE)
577579

578580
bomb = io.BytesIO(bomb)
579581
decomp = igzip.GzipFile(fileobj=bomb)
580582
self.assertEqual(decomp.read(1), b'\0')
581-
max_decomp = 1 + io.DEFAULT_BUFFER_SIZE
583+
max_decomp = 1 + igzip.READ_BUFFER_SIZE
582584
self.assertLessEqual(decomp._buffer.raw.tell(), max_decomp,
583585
"Excessive amount of data was decompressed")
584586

0 commit comments

Comments
 (0)