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

Method test_init_bad_check

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

Source from the content-addressed store, hash-verified

631 LZMAFile(BytesIO(COMPRESSED_XZ), "rw")
632
633 def test_init_bad_check(self):
634 with self.assertRaises(TypeError):
635 LZMAFile(BytesIO(), "w", check=b"asd")
636 # CHECK_UNKNOWN and anything above CHECK_ID_MAX should be invalid.
637 with self.assertRaises(LZMAError):
638 LZMAFile(BytesIO(), "w", check=lzma.CHECK_UNKNOWN)
639 with self.assertRaises(LZMAError):
640 LZMAFile(BytesIO(), "w", check=lzma.CHECK_ID_MAX + 3)
641 # Cannot specify a check with mode="r".
642 with self.assertRaises(ValueError):
643 LZMAFile(BytesIO(COMPRESSED_XZ), check=lzma.CHECK_NONE)
644 with self.assertRaises(ValueError):
645 LZMAFile(BytesIO(COMPRESSED_XZ), check=lzma.CHECK_CRC32)
646 with self.assertRaises(ValueError):
647 LZMAFile(BytesIO(COMPRESSED_XZ), check=lzma.CHECK_CRC64)
648 with self.assertRaises(ValueError):
649 LZMAFile(BytesIO(COMPRESSED_XZ), check=lzma.CHECK_SHA256)
650 with self.assertRaises(ValueError):
651 LZMAFile(BytesIO(COMPRESSED_XZ), check=lzma.CHECK_UNKNOWN)
652
653 def test_init_bad_preset(self):
654 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