Skip to content

Commit

Permalink
Added a block of code in tests.test_reader.test_read_csv() for testin…
Browse files Browse the repository at this point in the history
…g if read_csv() can read BytesIO. It currently raises AssertionError.
  • Loading branch information
DilyOng committed Feb 21, 2025
1 parent d24c6c3 commit 47b8ab1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tests/test_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
from anesthetic.read.hdf import HDFStore, read_hdf
from anesthetic.read.csv import read_csv
from utils import pytables_mark_xfail, h5py_mark_xfail, getdist_mark_skip
import io


@pytest.fixture(autouse=True)
Expand Down Expand Up @@ -331,3 +332,10 @@ def test_read_csv(tmp_path, root):
samples_ = read_chains(filename)
samples_.root = samples.root
assert_frame_equal(samples, samples_)

with open(filename, 'rb') as f:
csv_bytes = f.read()
bytesio_obj = io.BytesIO(csv_bytes)
samples_bytes = read_csv(bytesio_obj)
samples_bytes.root = samples.root
assert_frame_equal(samples, samples_bytes)

0 comments on commit 47b8ab1

Please sign in to comment.