@@ -684,10 +684,9 @@ def test_frame_select_complex2():
684
684
685
685
# scope with list like
686
686
l0 = selection .index .tolist () # noqa:F841
687
- store = HDFStore (hh )
688
- result = store .select ("df" , where = "l1=l0" )
689
- tm .assert_frame_equal (result , expected )
690
- store .close ()
687
+ with HDFStore (hh ) as store :
688
+ result = store .select ("df" , where = "l1=l0" )
689
+ tm .assert_frame_equal (result , expected )
691
690
692
691
result = read_hdf (hh , "df" , where = "l1=l0" )
693
692
tm .assert_frame_equal (result , expected )
@@ -707,21 +706,19 @@ def test_frame_select_complex2():
707
706
tm .assert_frame_equal (result , expected )
708
707
709
708
# scope with index
710
- store = HDFStore (hh )
711
-
712
- result = store .select ("df" , where = "l1=index" )
713
- tm .assert_frame_equal (result , expected )
709
+ with HDFStore (hh ) as store :
714
710
715
- result = store .select ("df" , where = "l1=selection. index" )
716
- tm .assert_frame_equal (result , expected )
711
+ result = store .select ("df" , where = "l1=index" )
712
+ tm .assert_frame_equal (result , expected )
717
713
718
- result = store .select ("df" , where = "l1=selection.index.tolist() " )
719
- tm .assert_frame_equal (result , expected )
714
+ result = store .select ("df" , where = "l1=selection.index" )
715
+ tm .assert_frame_equal (result , expected )
720
716
721
- result = store .select ("df" , where = "l1=list( selection.index)" )
722
- tm .assert_frame_equal (result , expected )
717
+ result = store .select ("df" , where = "l1=selection.index.tolist( )" )
718
+ tm .assert_frame_equal (result , expected )
723
719
724
- store .close ()
720
+ result = store .select ("df" , where = "l1=list(selection.index)" )
721
+ tm .assert_frame_equal (result , expected )
725
722
726
723
727
724
def test_invalid_filtering (setup_path ):
0 commit comments