MCPcopy Index your code
hub / github.com/python/cpython / test_decompress_limited

Method test_decompress_limited

Lib/test/test_lzma.py:1068–1077  ·  view source on GitHub ↗

Decompressed data buffering should be limited

(self)

Source from the content-addressed store, hash-verified

1066 self.assertListEqual(f.readlines(), lines)
1067
1068 def test_decompress_limited(self):
1069 """Decompressed data buffering should be limited"""
1070 bomb = lzma.compress(b'\0' * int(2e6), preset=6)
1071 self.assertLess(len(bomb), _streams.BUFFER_SIZE)
1072
1073 decomp = LZMAFile(BytesIO(bomb))
1074 self.assertEqual(decomp.read(1), b'\0')
1075 max_decomp = 1 + DEFAULT_BUFFER_SIZE
1076 self.assertLessEqual(decomp._buffer.raw.tell(), max_decomp,
1077 "Excessive amount of data was decompressed")
1078
1079 def test_write(self):
1080 with BytesIO() as dst:

Callers

nothing calls this directly

Calls 8

readMethod · 0.95
LZMAFileClass · 0.90
BytesIOClass · 0.90
assertLessEqualMethod · 0.80
compressMethod · 0.45
assertLessMethod · 0.45
assertEqualMethod · 0.45
tellMethod · 0.45

Tested by

no test coverage detected