3030from pandas .util .testing import (assert_panel4d_equal ,
3131 assert_panel_equal ,
3232 assert_frame_equal ,
33- assert_series_equal )
33+ assert_series_equal ,
34+ assert_produces_warning )
3435from pandas import concat , Timestamp
3536from pandas import compat
3637from pandas .compat import range , lrange , u
@@ -2329,13 +2330,12 @@ def test_terms(self):
23292330 assert_panel4d_equal (result , expected )
23302331
23312332 # back compat invalid terms
2332- terms = [
2333- dict (field = 'major_axis' , op = '>' , value = '20121114' ),
2334- [ dict (field = 'major_axis' , op = '>' , value = '20121114' ) ],
2335- [ "minor_axis=['A','B']" , dict (field = 'major_axis' , op = '>' , value = '20121114' ) ]
2336- ]
2333+ terms = [dict (field = 'major_axis' , op = '>' , value = '20121114' ),
2334+ [dict (field = 'major_axis' , op = '>' , value = '20121114' )],
2335+ ["minor_axis=['A','B']" ,
2336+ dict (field = 'major_axis' , op = '>' , value = '20121114' )]]
23372337 for t in terms :
2338- with tm .assert_produces_warning (expected_warning = DeprecationWarning ,
2338+ with tm .assert_produces_warning (expected_warning = FutureWarning ,
23392339 check_stacklevel = False ):
23402340 Term (t )
23412341
@@ -2428,12 +2428,14 @@ def test_backwards_compat_without_term_object(self):
24282428 wp = Panel (np .random .randn (2 , 5 , 4 ), items = ['Item1' , 'Item2' ],
24292429 major_axis = date_range ('1/1/2000' , periods = 5 ),
24302430 minor_axis = ['A' , 'B' , 'C' , 'D' ])
2431- store .append ('wp' ,wp )
2432- with tm . assert_produces_warning (expected_warning = DeprecationWarning ,
2433- check_stacklevel = not compat . PY3 ):
2431+ store .append ('wp' , wp )
2432+ with assert_produces_warning (expected_warning = FutureWarning ,
2433+ check_stacklevel = False ):
24342434 result = store .select ('wp' , [('major_axis>20000102' ),
2435- ('minor_axis' , '=' , ['A' ,'B' ]) ])
2436- expected = wp .loc [:,wp .major_axis > Timestamp ('20000102' ),['A' ,'B' ]]
2435+ ('minor_axis' , '=' , ['A' , 'B' ])])
2436+ expected = wp .loc [:,
2437+ wp .major_axis > Timestamp ('20000102' ),
2438+ ['A' , 'B' ]]
24372439 assert_panel_equal (result , expected )
24382440
24392441 store .remove ('wp' , ('major_axis>20000103' ))
@@ -2446,29 +2448,40 @@ def test_backwards_compat_without_term_object(self):
24462448 wp = Panel (np .random .randn (2 , 5 , 4 ), items = ['Item1' , 'Item2' ],
24472449 major_axis = date_range ('1/1/2000' , periods = 5 ),
24482450 minor_axis = ['A' , 'B' , 'C' , 'D' ])
2449- store .append ('wp' ,wp )
2451+ store .append ('wp' , wp )
24502452
24512453 # stringified datetimes
2452- with tm .assert_produces_warning (expected_warning = DeprecationWarning ,
2453- check_stacklevel = not compat .PY3 ):
2454- result = store .select ('wp' , [('major_axis' ,'>' ,datetime .datetime (2000 ,1 ,2 ))])
2455- expected = wp .loc [:,wp .major_axis > Timestamp ('20000102' )]
2454+ with assert_produces_warning (expected_warning = FutureWarning ,
2455+ check_stacklevel = False ):
2456+ result = store .select ('wp' ,
2457+ [('major_axis' ,
2458+ '>' ,
2459+ datetime .datetime (2000 , 1 , 2 ))])
2460+ expected = wp .loc [:, wp .major_axis > Timestamp ('20000102' )]
24562461 assert_panel_equal (result , expected )
2457- with tm .assert_produces_warning (expected_warning = DeprecationWarning ,
2458- check_stacklevel = not compat .PY3 ):
2459- result = store .select ('wp' , [('major_axis' ,'>' ,datetime .datetime (2000 ,1 ,2 ,0 ,0 ))])
2460- expected = wp .loc [:,wp .major_axis > Timestamp ('20000102' )]
2462+ with assert_produces_warning (expected_warning = FutureWarning ,
2463+ check_stacklevel = False ):
2464+ result = store .select ('wp' ,
2465+ [('major_axis' ,
2466+ '>' ,
2467+ datetime .datetime (2000 , 1 , 2 , 0 , 0 ))])
2468+ expected = wp .loc [:, wp .major_axis > Timestamp ('20000102' )]
24612469 assert_panel_equal (result , expected )
2462- with tm .assert_produces_warning (expected_warning = DeprecationWarning ,
2463- check_stacklevel = not compat .PY3 ):
2464- result = store .select ('wp' , [('major_axis' ,'=' ,[datetime .datetime (2000 ,1 ,2 ,0 ,0 ),
2465- datetime .datetime (2000 ,1 ,3 ,0 ,0 )])])
2466- expected = wp .loc [:,[Timestamp ('20000102' ),Timestamp ('20000103' )]]
2470+ with assert_produces_warning (expected_warning = FutureWarning ,
2471+ check_stacklevel = False ):
2472+ result = store .select ('wp' ,
2473+ [('major_axis' ,
2474+ '=' ,
2475+ [datetime .datetime (2000 , 1 , 2 , 0 , 0 ),
2476+ datetime .datetime (2000 , 1 , 3 , 0 , 0 )])]
2477+ )
2478+ expected = wp .loc [:, [Timestamp ('20000102' ),
2479+ Timestamp ('20000103' )]]
24672480 assert_panel_equal (result , expected )
2468- with tm . assert_produces_warning (expected_warning = DeprecationWarning ,
2469- check_stacklevel = not compat . PY3 ):
2470- result = store .select ('wp' , [('minor_axis' ,'=' ,['A' ,'B' ])])
2471- expected = wp .loc [:,:, ['A' ,'B' ]]
2481+ with assert_produces_warning (expected_warning = FutureWarning ,
2482+ check_stacklevel = False ):
2483+ result = store .select ('wp' , [('minor_axis' , '=' , ['A' , 'B' ])])
2484+ expected = wp .loc [:, :, ['A' , 'B' ]]
24722485 assert_panel_equal (result , expected )
24732486
24742487 def test_same_name_scoping (self ):
0 commit comments