Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions pandas/tests/io/pytables/test_keys.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
date_range,
)
from pandas.tests.io.pytables.common import (
ensure_clean_store,
tables,
tables
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be

from pandas.tests.io.pytables.common import tables

See the pre-commit section for how to run code checks. It will catch errors like this.

)

pytestmark = [pytest.mark.single_cpu]


def test_keys(setup_path):
with ensure_clean_store(setup_path) as store:
def test_keys(tmp_path):
path = tmp_path / "test_keys.h5"
with HDFStore(path) as store:
store["a"] = Series(
np.arange(10, dtype=np.float64), index=date_range("2020-01-01", periods=10)
)
Expand Down Expand Up @@ -62,20 +62,21 @@ class Table3(tables.IsDescription):
assert len(df.columns) == 1


def test_keys_illegal_include_keyword_value(setup_path):
with ensure_clean_store(setup_path) as store:
def test_keys_illegal_include_keyword_value(tmp_path):
path = tmp_path / "test_keys_illegal_include_keyword_value.h5"
with HDFStore(path) as store:
with pytest.raises(
ValueError,
match="`include` should be either 'pandas' or 'native' but is 'illegal'",
):
store.keys(include="illegal")


def test_keys_ignore_hdf_softlink(setup_path):
def test_keys_ignore_hdf_softlink(tmp_path):
# GH 20523
# Puts a softlink into HDF file and rereads

with ensure_clean_store(setup_path) as store:
path = tmp_path / "test_keys_ignore_hdf_softlink.h5"
with HDFStore(path) as store:
df = DataFrame({"A": range(5), "B": range(5)})
store.put("df", df)

Expand Down
Loading