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

Method test_init_bad_preset

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

Source from the content-addressed store, hash-verified

651 LZMAFile(BytesIO(COMPRESSED_XZ), check=lzma.CHECK_UNKNOWN)
652
653 def test_init_bad_preset(self):
654 with self.assertRaises(TypeError):
655 LZMAFile(BytesIO(), "w", preset=4.39)
656 with self.assertRaises(LZMAError):
657 LZMAFile(BytesIO(), "w", preset=10)
658 with self.assertRaises(LZMAError):
659 LZMAFile(BytesIO(), "w", preset=23)
660 with self.assertRaises(ValueError):
661 LZMAFile(BytesIO(), "w", preset=-1)
662 with self.assertRaises(ValueError):
663 LZMAFile(BytesIO(), "w", preset=-7)
664 with self.assertRaises(OverflowError):
665 LZMAFile(BytesIO(), "w", preset=2**1000)
666 with self.assertRaises(TypeError):
667 LZMAFile(BytesIO(), "w", preset="foo")
668 # Cannot specify a preset with mode="r".
669 with self.assertRaises(ValueError):
670 LZMAFile(BytesIO(COMPRESSED_XZ), preset=3)
671
672 def test_init_bad_filter_spec(self):
673 with self.assertRaises(TypeError):

Callers

nothing calls this directly

Calls 3

LZMAFileClass · 0.90
BytesIOClass · 0.90
assertRaisesMethod · 0.45

Tested by

no test coverage detected