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):
12941294 # read with KeyError before another write
12951295 df .to_hdf (path , "k2" )
12961296
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' )
12981304
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 ):
12991313 with ensure_clean_store (setup_path ) as store :
13001314
13011315 # column oriented
You can’t perform that action at this time.
0 commit comments