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

Method test_seek_bad_args

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

Source from the content-addressed store, hash-verified

2278 self.assertEqual(f.read(), DECOMPRESSED_100_PLUS_32KB)
2279
2280 def test_seek_bad_args(self):
2281 f = ZstdFile(io.BytesIO(COMPRESSED_100_PLUS_32KB))
2282 f.close()
2283 self.assertRaises(ValueError, f.seek, 0)
2284 with ZstdFile(io.BytesIO(), "w") as f:
2285 self.assertRaises(ValueError, f.seek, 0)
2286 with ZstdFile(io.BytesIO(COMPRESSED_100_PLUS_32KB)) as f:
2287 self.assertRaises(ValueError, f.seek, 0, 3)
2288 # io.BufferedReader raises TypeError instead of ValueError
2289 self.assertRaises((TypeError, ValueError), f.seek, 9, ())
2290 self.assertRaises(TypeError, f.seek, None)
2291 self.assertRaises(TypeError, f.seek, b"derp")
2292
2293 def test_seek_not_seekable(self):
2294 class C(io.BytesIO):

Callers

nothing calls this directly

Calls 3

closeMethod · 0.95
ZstdFileClass · 0.90
assertRaisesMethod · 0.45

Tested by

no test coverage detected