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

Method test_readinto

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

lenFunction · 0.85
writeMethod · 0.45
readintoMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected