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

Method testSeekable

Lib/test/test_bz2.py:397–421  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

395 self.assertRaises(ValueError, bz2f.fileno)
396
397 def testSeekable(self):
398 bz2f = BZ2File(BytesIO(self.DATA))
399 try:
400 self.assertTrue(bz2f.seekable())
401 bz2f.read()
402 self.assertTrue(bz2f.seekable())
403 finally:
404 bz2f.close()
405 self.assertRaises(ValueError, bz2f.seekable)
406
407 bz2f = BZ2File(BytesIO(), "w")
408 try:
409 self.assertFalse(bz2f.seekable())
410 finally:
411 bz2f.close()
412 self.assertRaises(ValueError, bz2f.seekable)
413
414 src = BytesIO(self.DATA)
415 src.seekable = lambda: False
416 bz2f = BZ2File(src)
417 try:
418 self.assertFalse(bz2f.seekable())
419 finally:
420 bz2f.close()
421 self.assertRaises(ValueError, bz2f.seekable)
422
423 def testReadable(self):
424 bz2f = BZ2File(BytesIO(self.DATA))

Callers

nothing calls this directly

Calls 8

seekableMethod · 0.95
readMethod · 0.95
closeMethod · 0.95
BZ2FileClass · 0.90
BytesIOClass · 0.90
assertTrueMethod · 0.80
assertFalseMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected