| 194 | |
| 195 | @pytest.mark.parametrize("fmt,blocksize", fmt_bs) |
| 196 | def test_compression(fmt, blocksize): |
| 197 | if fmt not in compress: |
| 198 | pytest.skip("compression function not provided") |
| 199 | files2 = valmap(compress[fmt], files) |
| 200 | with filetexts(files2, mode="b"): |
| 201 | if fmt and blocksize: |
| 202 | with pytest.raises(ValueError): |
| 203 | read_bytes( |
| 204 | ".test.accounts.*.json", |
| 205 | blocksize=blocksize, |
| 206 | delimiter=b"\n", |
| 207 | compression=fmt, |
| 208 | ) |
| 209 | return |
| 210 | sample, values = read_bytes( |
| 211 | ".test.accounts.*.json", |
| 212 | blocksize=blocksize, |
| 213 | delimiter=b"\n", |
| 214 | compression=fmt, |
| 215 | ) |
| 216 | assert sample[:5] == files[sorted(files)[0]][:5] |
| 217 | assert sample.endswith(b"\n") |
| 218 | |
| 219 | results = compute(*concat(values)) |
| 220 | assert b"".join(results) == b"".join([files[k] for k in sorted(files)]) |
| 221 | |
| 222 | |
| 223 | def test_open_files(): |