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

Method testMixedIterationAndReads

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

Source from the content-addressed store, hash-verified

519 pass
520
521 def testMixedIterationAndReads(self):
522 self.createTempFile()
523 linelen = len(self.TEXT_LINES[0])
524 halflen = linelen // 2
525 with BZ2File(self.filename) as bz2f:
526 bz2f.read(halflen)
527 self.assertEqual(next(bz2f), self.TEXT_LINES[0][halflen:])
528 self.assertEqual(bz2f.read(), self.TEXT[linelen:])
529 with BZ2File(self.filename) as bz2f:
530 bz2f.readline()
531 self.assertEqual(next(bz2f), self.TEXT_LINES[1])
532 self.assertEqual(bz2f.readline(), self.TEXT_LINES[2])
533 with BZ2File(self.filename) as bz2f:
534 bz2f.readlines()
535 self.assertRaises(StopIteration, next, bz2f)
536 self.assertEqual(bz2f.readlines(), [])
537
538 def testMultiStreamOrdering(self):
539 # Test the ordering of streams when reading a multi-stream archive.

Callers

nothing calls this directly

Calls 7

createTempFileMethod · 0.95
BZ2FileClass · 0.90
readMethod · 0.45
assertEqualMethod · 0.45
readlineMethod · 0.45
readlinesMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected