Skip to content

Commit 58fe3fd

Browse files
committed
Test reading concatenated/multiblock gzips works
1 parent 18b157f commit 58fe3fd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

tests/test_xopen.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,20 @@ def test_bare_read_from_gz():
345345
assert f.read() == "hello"
346346

347347

348+
@pytest.mark.parametrize("threads", [None, 0, 2])
349+
def test_concatenated_gzip(tmp_path, threads):
350+
path = tmp_path / "hello.gz"
351+
with gzip.open(path, mode="wt") as f:
352+
print("Hello", file=f)
353+
with gzip.open(path, mode="at") as f:
354+
print("world", file=f)
355+
356+
with xopen(path, threads=threads) as f:
357+
lines = list(f)
358+
359+
assert lines == ["Hello\n", "world\n"]
360+
361+
348362
def test_read_no_threads(ext):
349363
klasses = {
350364
".bz2": bz2.BZ2File,

0 commit comments

Comments
 (0)