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

Method test_seek_bad_args

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

Source from the content-addressed store, hash-verified

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