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

Method test_issue21872

Lib/test/test_lzma.py:1347–1375  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1345 self.assertRaises(ValueError, f.tell)
1346
1347 def test_issue21872(self):
1348 # sometimes decompress data incompletely
1349
1350 # ---------------------
1351 # when max_length == -1
1352 # ---------------------
1353 d1 = LZMADecompressor()
1354 entire = d1.decompress(ISSUE_21872_DAT, max_length=-1)
1355 self.assertEqual(len(entire), 13160)
1356 self.assertTrue(d1.eof)
1357
1358 # ---------------------
1359 # when max_length > 0
1360 # ---------------------
1361 d2 = LZMADecompressor()
1362
1363 # When this value of max_length is used, the input and output
1364 # buffers are exhausted at the same time, and lzs's internal
1365 # state still have 11 bytes can be output.
1366 out1 = d2.decompress(ISSUE_21872_DAT, max_length=13149)
1367 self.assertFalse(d2.needs_input) # ensure needs_input mechanism works
1368 self.assertFalse(d2.eof)
1369
1370 # simulate needs_input mechanism
1371 # output internal state's 11 bytes
1372 out2 = d2.decompress(b'')
1373 self.assertEqual(len(out2), 11)
1374 self.assertTrue(d2.eof)
1375 self.assertEqual(out1 + out2, entire)
1376
1377 def test_issue44439(self):
1378 q = array.array('Q', [1, 2, 3, 4, 5])

Callers

nothing calls this directly

Calls 5

decompressMethod · 0.95
LZMADecompressorClass · 0.85
assertTrueMethod · 0.80
assertFalseMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected