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

Method test_readinto

Lib/test/test_gzip.py:146–156  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

144 self.assertEqual(b''.join(blocks), data1 * 50)
145
146 def test_readinto(self):
147 # 10MB of uncompressible data to ensure multiple reads
148 large_data = os.urandom(10 * 2**20)
149 with gzip.GzipFile(self.filename, 'wb') as f:
150 f.write(large_data)
151
152 buf = bytearray(len(large_data))
153 with gzip.GzipFile(self.filename, 'r') as f:
154 nbytes = f.readinto(buf)
155 self.assertEqual(nbytes, len(large_data))
156 self.assertEqual(buf, large_data)
157
158 def test_readinto1(self):
159 # 10MB of uncompressible data to ensure multiple reads

Callers

nothing calls this directly

Calls 3

writeMethod · 0.45
readintoMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected