Skip to content

Commit e3a2930

Browse files
committed
Unit test simulating GH 25766
1 parent 72f4098 commit e3a2930

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

pandas/tests/io/test_pytables.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,6 +1223,16 @@ def test_append_all_nans(self):
12231223
reloaded = read_hdf(path, 'df_with_missing')
12241224
tm.assert_frame_equal(df_with_missing, reloaded)
12251225

1226+
def test_read_missing_key_close_store(self):
1227+
# GH 25766
1228+
with ensure_clean_path(self.path) as path:
1229+
df = pd.DataFrame({'a': range(2), 'b': range(2)})
1230+
df.to_hdf(path, 'k1')
1231+
1232+
pytest.raises(KeyError, pd.read_hdf, path, 'k2')
1233+
1234+
df.to_hdf(path, 'k2')
1235+
12261236
def test_append_frame_column_oriented(self):
12271237

12281238
with ensure_clean_store(self.path) as store:

0 commit comments

Comments
 (0)