MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_init_bad_mode

Method test_init_bad_mode

Lib/test/test_zstd.py:1638–1672  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1636 os.remove(filename)
1637
1638 def test_init_bad_mode(self):
1639 with self.assertRaises(ValueError):
1640 ZstdFile(io.BytesIO(COMPRESSED_100_PLUS_32KB), (3, "x"))
1641 with self.assertRaises(ValueError):
1642 ZstdFile(io.BytesIO(COMPRESSED_100_PLUS_32KB), "")
1643 with self.assertRaises(ValueError):
1644 ZstdFile(io.BytesIO(COMPRESSED_100_PLUS_32KB), "xt")
1645 with self.assertRaises(ValueError):
1646 ZstdFile(io.BytesIO(COMPRESSED_100_PLUS_32KB), "x+")
1647 with self.assertRaises(ValueError):
1648 ZstdFile(io.BytesIO(COMPRESSED_100_PLUS_32KB), "rx")
1649 with self.assertRaises(ValueError):
1650 ZstdFile(io.BytesIO(COMPRESSED_100_PLUS_32KB), "wx")
1651 with self.assertRaises(ValueError):
1652 ZstdFile(io.BytesIO(COMPRESSED_100_PLUS_32KB), "rt")
1653 with self.assertRaises(ValueError):
1654 ZstdFile(io.BytesIO(COMPRESSED_100_PLUS_32KB), "r+")
1655 with self.assertRaises(ValueError):
1656 ZstdFile(io.BytesIO(COMPRESSED_100_PLUS_32KB), "wt")
1657 with self.assertRaises(ValueError):
1658 ZstdFile(io.BytesIO(COMPRESSED_100_PLUS_32KB), "w+")
1659 with self.assertRaises(ValueError):
1660 ZstdFile(io.BytesIO(COMPRESSED_100_PLUS_32KB), "rw")
1661
1662 with self.assertRaisesRegex(TypeError,
1663 r"not be a CompressionParameter"):
1664 ZstdFile(io.BytesIO(), 'rb',
1665 options={CompressionParameter.compression_level:5})
1666 with self.assertRaisesRegex(TypeError,
1667 r"not be a DecompressionParameter"):
1668 ZstdFile(io.BytesIO(), 'wb',
1669 options={DecompressionParameter.window_log_max:21})
1670
1671 with self.assertRaises(TypeError):
1672 ZstdFile(io.BytesIO(COMPRESSED_100_PLUS_32KB), "r", level=12)
1673
1674 def test_init_bad_check(self):
1675 with self.assertRaises(TypeError):

Callers

nothing calls this directly

Calls 3

ZstdFileClass · 0.90
assertRaisesRegexMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected