(self)
| 2184 | self.assertEqual(dst.getvalue(), expected) |
| 2185 | |
| 2186 | def test_write_append(self): |
| 2187 | def comp(data): |
| 2188 | comp = ZstdCompressor() |
| 2189 | return comp.compress(data) + comp.flush() |
| 2190 | |
| 2191 | part1 = THIS_FILE_BYTES[:_1K] |
| 2192 | part2 = THIS_FILE_BYTES[_1K:1536] |
| 2193 | part3 = THIS_FILE_BYTES[1536:] |
| 2194 | expected = b"".join(comp(x) for x in (part1, part2, part3)) |
| 2195 | with io.BytesIO() as dst: |
| 2196 | with ZstdFile(dst, "w") as f: |
| 2197 | f.write(part1) |
| 2198 | with ZstdFile(dst, "a") as f: |
| 2199 | f.write(part2) |
| 2200 | with ZstdFile(dst, "a") as f: |
| 2201 | f.write(part3) |
| 2202 | self.assertEqual(dst.getvalue(), expected) |
| 2203 | |
| 2204 | def test_write_bad_args(self): |
| 2205 | f = ZstdFile(io.BytesIO(), "w") |
nothing calls this directly
no test coverage detected