Skip to content

Commit 850acff

Browse files
Add test to check the error path for an illegal include keyword parameter value
1 parent 76738f9 commit 850acff

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

pandas/io/pytables.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ def keys(self, include: Optional[str] = "pandas") -> List[str]:
609609
n._v_pathname for n in self._handle.walk_nodes("/", classname="Table")
610610
]
611611
raise ValueError(
612-
f"`include` should be either 'pandas' or 'native' but is [{include}]"
612+
f"`include` should be either 'pandas' or 'native' but is '{include}'"
613613
)
614614

615615
def __iter__(self):

pandas/tests/io/pytables/test_store.py

+8
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,14 @@ class Table3(tables.IsDescription):
318318
assert set(store.keys(include="native")) == expected
319319
assert set(store.keys(include="pandas")) == set()
320320

321+
def test_keys_illegal_include_keyword_value(self, setup_path):
322+
with ensure_clean_store(setup_path) as store:
323+
with pytest.raises(
324+
ValueError,
325+
match="`include` should be either 'pandas' or 'native' but is 'illegal'",
326+
):
327+
store.keys(include="illegal")
328+
321329
def test_keys_ignore_hdf_softlink(self, setup_path):
322330

323331
# GH 20523

0 commit comments

Comments
 (0)