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

Method test_seek_bad_args

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

Source from the content-addressed store, hash-verified

1311 self.assertEqual(f.read(), INPUT)
1312
1313 def test_seek_bad_args(self):
1314 f = LZMAFile(BytesIO(COMPRESSED_XZ))
1315 f.close()
1316 self.assertRaises(ValueError, f.seek, 0)
1317 with LZMAFile(BytesIO(), "w") as f:
1318 self.assertRaises(ValueError, f.seek, 0)
1319 with LZMAFile(BytesIO(COMPRESSED_XZ)) as f:
1320 self.assertRaises(ValueError, f.seek, 0, 3)
1321 # io.BufferedReader raises TypeError instead of ValueError
1322 self.assertRaises((TypeError, ValueError), f.seek, 9, ())
1323 self.assertRaises(TypeError, f.seek, None)
1324 self.assertRaises(TypeError, f.seek, b"derp")
1325
1326 def test_tell(self):
1327 with LZMAFile(BytesIO(COMPRESSED_XZ)) as f:

Callers

nothing calls this directly

Calls 4

closeMethod · 0.95
LZMAFileClass · 0.90
BytesIOClass · 0.90
assertRaisesMethod · 0.45

Tested by

no test coverage detected