File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1294,8 +1294,22 @@ def test_read_missing_key_close_store(self, setup_path):
1294
1294
# read with KeyError before another write
1295
1295
df .to_hdf (path , "k2" )
1296
1296
1297
- def test_append_frame_column_oriented (self , setup_path ):
1297
+ def test_read_missing_key_opened_store (self , setup_path ):
1298
+ # GH 28699
1299
+ with ensure_clean_path (setup_path ) as path :
1300
+ df = pd .DataFrame ({"a" : range (2 ), "b" : range (2 )})
1301
+ df .to_hdf (path , "k1" )
1302
+
1303
+ store = pd .HDFStore (path , 'r' )
1298
1304
1305
+ with pytest .raises (KeyError , match = "'No object named k2 in the file'" ):
1306
+ pd .read_hdf (store , "k2" )
1307
+
1308
+ # Test that the file is still open after a KeyError and that we can
1309
+ # still read from it.
1310
+ pd .read_hdf (store , "k1" )
1311
+
1312
+ def test_append_frame_column_oriented (self , setup_path ):
1299
1313
with ensure_clean_store (setup_path ) as store :
1300
1314
1301
1315
# column oriented
You can’t perform that action at this time.
0 commit comments