We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 865cb98 commit b3dd998Copy full SHA for b3dd998
tests/test_xopen.py
@@ -588,3 +588,17 @@ def test_pass_file_object_for_writing(tmp_path, ext):
588
f.write(first_line)
589
with xopen(tmp_path / "out{ext}", "rb") as fh:
590
assert fh.readline() == first_line
591
+
592
593
+@pytest.mark.parametrize("ext", extensions)
594
+def test_pass_bytesio_for_writing(ext):
595
+ filelike = io.BytesIO()
596
+ format = ext[1:]
597
+ if ext == ".zst" and zstandard is None:
598
+ return
599
+ first_line = CONTENT_LINES[0].encode("utf-8")
600
+ with xopen(filelike, "wb", format=format) as f:
601
+ f.write(first_line)
602
+ filelike.seek(0)
603
+ with xopen(filelike, "rb", format=format) as fh:
604
+ assert fh.readline() == first_line
0 commit comments