(self)
| 510 | class DecompressorTestCase(unittest.TestCase): |
| 511 | |
| 512 | def test_simple_decompress_bad_args(self): |
| 513 | # ZstdDecompressor |
| 514 | self.assertRaises(TypeError, ZstdDecompressor, ()) |
| 515 | self.assertRaises(TypeError, ZstdDecompressor, zstd_dict=123) |
| 516 | self.assertRaises(TypeError, ZstdDecompressor, zstd_dict=b'abc') |
| 517 | self.assertRaises(TypeError, ZstdDecompressor, zstd_dict={1:2, 3:4}) |
| 518 | |
| 519 | self.assertRaises(TypeError, ZstdDecompressor, options=123) |
| 520 | self.assertRaises(TypeError, ZstdDecompressor, options='abc') |
| 521 | self.assertRaises(TypeError, ZstdDecompressor, options=b'abc') |
| 522 | |
| 523 | with self.assertRaises(ValueError): |
| 524 | ZstdDecompressor(options={C_INT_MAX: 100}) |
| 525 | with self.assertRaises(ValueError): |
| 526 | ZstdDecompressor(options={C_INT_MIN: 100}) |
| 527 | with self.assertRaises(ValueError): |
| 528 | ZstdDecompressor(options={0: C_INT_MAX}) |
| 529 | with self.assertRaises(OverflowError): |
| 530 | ZstdDecompressor(options={2**1000: 100}) |
| 531 | with self.assertRaises(OverflowError): |
| 532 | ZstdDecompressor(options={-(2**1000): 100}) |
| 533 | with self.assertRaises(OverflowError): |
| 534 | ZstdDecompressor(options={0: -(2**1000)}) |
| 535 | |
| 536 | with self.assertRaises(ValueError): |
| 537 | ZstdDecompressor(options={DecompressionParameter.window_log_max: 100}) |
| 538 | with self.assertRaises(ValueError): |
| 539 | ZstdDecompressor(options={3333: 100}) |
| 540 | |
| 541 | empty = compress(b'') |
| 542 | lzd = ZstdDecompressor() |
| 543 | self.assertRaises(TypeError, lzd.decompress) |
| 544 | self.assertRaises(TypeError, lzd.decompress, b"foo", b"bar") |
| 545 | self.assertRaises(TypeError, lzd.decompress, "str") |
| 546 | lzd.decompress(empty) |
| 547 | |
| 548 | def test_decompress_parameters(self): |
| 549 | d = {DecompressionParameter.window_log_max : 15} |
nothing calls this directly
no test coverage detected