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

Method test_writelines

Lib/test/test_zstd.py:2215–2226  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2213 self.assertRaises(TypeError, f.write, 789)
2214
2215 def test_writelines(self):
2216 def comp(data):
2217 comp = ZstdCompressor()
2218 return comp.compress(data) + comp.flush()
2219
2220 with io.BytesIO(THIS_FILE_BYTES) as f:
2221 lines = f.readlines()
2222 with io.BytesIO() as dst:
2223 with ZstdFile(dst, "w") as f:
2224 f.writelines(lines)
2225 expected = comp(THIS_FILE_BYTES)
2226 self.assertEqual(dst.getvalue(), expected)
2227
2228 def test_seek_forward(self):
2229 with ZstdFile(io.BytesIO(COMPRESSED_100_PLUS_32KB)) as f:

Callers

nothing calls this directly

Calls 5

ZstdFileClass · 0.90
readlinesMethod · 0.45
writelinesMethod · 0.45
assertEqualMethod · 0.45
getvalueMethod · 0.45

Tested by

no test coverage detected