Lines Matching refs:lzd
57 lzd = LZMADecompressor()
58 self.assertRaises(TypeError, lzd.decompress)
59 self.assertRaises(TypeError, lzd.decompress, b"foo", b"bar")
60 lzd.decompress(empty)
61 self.assertRaises(EOFError, lzd.decompress, b"quux")
75 lzd = LZMADecompressor()
76 lzd.decompress(COMPRESSED_XZ)
77 self.assertRaises(EOFError, lzd.decompress, b"nyan")
80 lzd = LZMADecompressor(memlimit=1024)
81 self.assertRaises(LZMAError, lzd.decompress, COMPRESSED_XZ)
83 lzd = LZMADecompressor(lzma.FORMAT_XZ, memlimit=1024)
84 self.assertRaises(LZMAError, lzd.decompress, COMPRESSED_XZ)
86 lzd = LZMADecompressor(lzma.FORMAT_ALONE, memlimit=1024)
87 self.assertRaises(LZMAError, lzd.decompress, COMPRESSED_ALONE)
91 def _test_decompressor(self, lzd, data, check, unused_data=b""): argument
92 self.assertFalse(lzd.eof)
93 out = lzd.decompress(data)
95 self.assertEqual(lzd.check, check)
96 self.assertTrue(lzd.eof)
97 self.assertEqual(lzd.unused_data, unused_data)
100 lzd = LZMADecompressor()
101 self._test_decompressor(lzd, COMPRESSED_XZ, lzma.CHECK_CRC64)
103 lzd = LZMADecompressor()
104 self._test_decompressor(lzd, COMPRESSED_ALONE, lzma.CHECK_NONE)
107 lzd = LZMADecompressor(lzma.FORMAT_XZ)
108 self._test_decompressor(lzd, COMPRESSED_XZ, lzma.CHECK_CRC64)
111 lzd = LZMADecompressor(lzma.FORMAT_ALONE)
112 self._test_decompressor(lzd, COMPRESSED_ALONE, lzma.CHECK_NONE)
115 lzd = LZMADecompressor(lzma.FORMAT_RAW, filters=FILTERS_RAW_1)
116 self._test_decompressor(lzd, COMPRESSED_RAW_1, lzma.CHECK_NONE)
119 lzd = LZMADecompressor(lzma.FORMAT_RAW, filters=FILTERS_RAW_2)
120 self._test_decompressor(lzd, COMPRESSED_RAW_2, lzma.CHECK_NONE)
123 lzd = LZMADecompressor(lzma.FORMAT_RAW, filters=FILTERS_RAW_3)
124 self._test_decompressor(lzd, COMPRESSED_RAW_3, lzma.CHECK_NONE)
127 lzd = LZMADecompressor(lzma.FORMAT_RAW, filters=FILTERS_RAW_4)
128 self._test_decompressor(lzd, COMPRESSED_RAW_4, lzma.CHECK_NONE)
131 lzd = LZMADecompressor()
134 self.assertFalse(lzd.eof)
135 out.append(lzd.decompress(COMPRESSED_XZ[i:i+10]))
138 self.assertEqual(lzd.check, lzma.CHECK_CRC64)
139 self.assertTrue(lzd.eof)
140 self.assertEqual(lzd.unused_data, b"")
143 lzd = LZMADecompressor()
146 self.assertFalse(lzd.eof)
147 out.append(lzd.decompress(b''))
148 out.append(lzd.decompress(b''))
149 out.append(lzd.decompress(b''))
150 out.append(lzd.decompress(COMPRESSED_XZ[i:i+10]))
153 self.assertEqual(lzd.check, lzma.CHECK_CRC64)
154 self.assertTrue(lzd.eof)
155 self.assertEqual(lzd.unused_data, b"")
158 lzd = LZMADecompressor()
164 out.append(lzd.decompress(COMPRESSED_XZ[:len_],
166 self.assertFalse(lzd.needs_input)
170 out.append(lzd.decompress(b'', max_length=max_length))
171 self.assertFalse(lzd.needs_input)
175 out.append(lzd.decompress(COMPRESSED_XZ[len_:],
180 while not lzd.eof:
181 out.append(lzd.decompress(b'', max_length=max_length))
186 self.assertEqual(lzd.check, lzma.CHECK_CRC64)
187 self.assertEqual(lzd.unused_data, b"")
192 lzd = LZMADecompressor()
196 self.assertEqual(lzd.decompress(COMPRESSED_XZ[:100],
201 out.append(lzd.decompress(b'', 2))
205 out.append(lzd.decompress(COMPRESSED_XZ[100:105], 15))
208 out.append(lzd.decompress(COMPRESSED_XZ[105:]))
214 lzd = LZMADecompressor()
218 self.assertEqual(lzd.decompress(COMPRESSED_XZ[:200],
220 out.append(lzd.decompress(b''))
223 out.append(lzd.decompress(COMPRESSED_XZ[200:280], 2))
226 out.append(lzd.decompress(COMPRESSED_XZ[280:300], 2))
229 out.append(lzd.decompress(COMPRESSED_XZ[300:]))
235 lzd = LZMADecompressor()
239 out.append(lzd.decompress(COMPRESSED_XZ[:200], 5))
242 out.append(lzd.decompress(COMPRESSED_XZ[200:300], 5))
245 out.append(lzd.decompress(COMPRESSED_XZ[300:]))
249 lzd = LZMADecompressor()
251 self._test_decompressor(lzd, COMPRESSED_XZ + extra, lzma.CHECK_CRC64,
255 lzd = LZMADecompressor()
256 self.assertRaises(LZMAError, lzd.decompress, COMPRESSED_RAW_1)
258 lzd = LZMADecompressor(lzma.FORMAT_XZ)
259 self.assertRaises(LZMAError, lzd.decompress, COMPRESSED_ALONE)
261 lzd = LZMADecompressor(lzma.FORMAT_ALONE)
262 self.assertRaises(LZMAError, lzd.decompress, COMPRESSED_XZ)
264 lzd = LZMADecompressor(lzma.FORMAT_RAW, filters=FILTERS_RAW_1)
265 self.assertRaises(LZMAError, lzd.decompress, COMPRESSED_XZ)
269 lzd = LZMADecompressor()
270 self.assertRaises(LZMAError, lzd.decompress, COMPRESSED_RAW_1)
272 self.assertRaises(LZMAError, lzd.decompress, COMPRESSED_RAW_1)
279 lzd = LZMADecompressor()
280 self._test_decompressor(lzd, cdata, lzma.CHECK_CRC64)
285 lzd = LZMADecompressor()
286 self._test_decompressor(lzd, cdata, lzma.CHECK_NONE)
291 lzd = LZMADecompressor(lzma.FORMAT_RAW, filters=FILTERS_RAW_4)
292 self._test_decompressor(lzd, cdata, lzma.CHECK_NONE)
301 lzd = LZMADecompressor(lzma.FORMAT_RAW, filters=FILTERS_RAW_4)
302 self._test_decompressor(lzd, cdata, lzma.CHECK_NONE)
311 lzd = LZMADecompressor()
312 self._test_decompressor(lzd, cdata, lzma.CHECK_CRC64)
324 lzd = LZMADecompressor()
325 self._test_decompressor(lzd, cdata, lzma.CHECK_CRC64)
330 lzd = LZMADecompressor()
331 self._test_decompressor(lzd, COMPRESSED_XZ + COMPRESSED_ALONE,
351 lzd = LZMADecompressor()
357 ddata = lzd.decompress(cdata)
374 lzd = LZMADecompressor()
377 lzd.__init__()