MCPcopy
hub / github.com/pandas-dev/pandas / test_read_hdf_errors

Function test_read_hdf_errors

pandas/tests/io/pytables/test_errors.py:224–241  ·  view source on GitHub ↗
(temp_h5_path)

Source from the content-addressed store, hash-verified

222
223
224def test_read_hdf_errors(temp_h5_path):
225 df = DataFrame(
226 np.random.default_rng(2).random((4, 5)),
227 index=list("abcd"),
228 columns=list("ABCDE"),
229 )
230
231 msg = r"File [\S]* does not exist"
232 with pytest.raises(OSError, match=msg):
233 read_hdf(f"{uuid.uuid4()}.h5", "key")
234
235 df.to_hdf(temp_h5_path, key="df")
236 store = HDFStore(temp_h5_path, mode="r")
237 store.close()
238
239 msg = "The HDFStore must be open for reading."
240 with pytest.raises(OSError, match=msg):
241 read_hdf(store, "df")
242
243
244def test_read_hdf_generic_buffer_errors():

Callers

nothing calls this directly

Calls 6

closeMethod · 0.95
DataFrameClass · 0.90
read_hdfFunction · 0.90
HDFStoreClass · 0.90
to_hdfMethod · 0.80
raisesMethod · 0.45

Tested by

no test coverage detected