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

Method testReadInto

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

Source from the content-addressed store, hash-verified

198 self.assertEqual(bz2f.read(), self.TEXT)
199
200 def testReadInto(self):
201 self.createTempFile()
202 with BZ2File(self.filename) as bz2f:
203 n = 128
204 b = bytearray(n)
205 self.assertEqual(bz2f.readinto(b), n)
206 self.assertEqual(b, self.TEXT[:n])
207 n = len(self.TEXT) - n
208 b = bytearray(len(self.TEXT))
209 self.assertEqual(bz2f.readinto(b), n)
210 self.assertEqual(b[:n], self.TEXT[-n:])
211
212 def testReadLine(self):
213 self.createTempFile()

Callers

nothing calls this directly

Calls 4

createTempFileMethod · 0.95
BZ2FileClass · 0.90
assertEqualMethod · 0.45
readintoMethod · 0.45

Tested by

no test coverage detected