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

Method testMixedIterationAndReads

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

Source from the content-addressed store, hash-verified

509 pass
510
511 def testMixedIterationAndReads(self):
512 self.createTempFile()
513 linelen = len(self.TEXT_LINES[0])
514 halflen = linelen // 2
515 with BZ2File(self.filename) as bz2f:
516 bz2f.read(halflen)
517 self.assertEqual(next(bz2f), self.TEXT_LINES[0][halflen:])
518 self.assertEqual(bz2f.read(), self.TEXT[linelen:])
519 with BZ2File(self.filename) as bz2f:
520 bz2f.readline()
521 self.assertEqual(next(bz2f), self.TEXT_LINES[1])
522 self.assertEqual(bz2f.readline(), self.TEXT_LINES[2])
523 with BZ2File(self.filename) as bz2f:
524 bz2f.readlines()
525 self.assertRaises(StopIteration, next, bz2f)
526 self.assertEqual(bz2f.readlines(), [])
527
528 def testMultiStreamOrdering(self):
529 # Test the ordering of streams when reading a multi-stream archive.

Callers

nothing calls this directly

Calls 9

createTempFileMethod · 0.95
BZ2FileClass · 0.90
lenFunction · 0.85
nextFunction · 0.85
readMethod · 0.45
assertEqualMethod · 0.45
readlineMethod · 0.45
readlinesMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected