@@ -122,7 +122,7 @@ def _maybe_remove(store, key):
122
122
pass
123
123
124
124
125
- def compat_assert_produces_warning (w ,f ):
125
+ def compat_assert_produces_warning (w , f ):
126
126
""" don't produce a warning under PY3 """
127
127
if compat .PY3 :
128
128
f ()
@@ -2516,7 +2516,8 @@ def test_terms(self):
2516
2516
[ "minor_axis=['A','B']" , dict (field = 'major_axis' , op = '>' , value = '20121114' ) ]
2517
2517
]
2518
2518
for t in terms :
2519
- with tm .assert_produces_warning (expected_warning = DeprecationWarning ):
2519
+ with tm .assert_produces_warning (expected_warning = DeprecationWarning ,
2520
+ check_stacklevel = False ):
2520
2521
Term (t )
2521
2522
2522
2523
# valid terms
@@ -2609,7 +2610,8 @@ def test_backwards_compat_without_term_object(self):
2609
2610
major_axis = date_range ('1/1/2000' , periods = 5 ),
2610
2611
minor_axis = ['A' , 'B' , 'C' , 'D' ])
2611
2612
store .append ('wp' ,wp )
2612
- with tm .assert_produces_warning (expected_warning = DeprecationWarning ):
2613
+ with tm .assert_produces_warning (expected_warning = DeprecationWarning ,
2614
+ check_stacklevel = not compat .PY3 ):
2613
2615
result = store .select ('wp' , [('major_axis>20000102' ),
2614
2616
('minor_axis' , '=' , ['A' ,'B' ]) ])
2615
2617
expected = wp .loc [:,wp .major_axis > Timestamp ('20000102' ),['A' ,'B' ]]
@@ -2628,20 +2630,24 @@ def test_backwards_compat_without_term_object(self):
2628
2630
store .append ('wp' ,wp )
2629
2631
2630
2632
# stringified datetimes
2631
- with tm .assert_produces_warning (expected_warning = DeprecationWarning ):
2633
+ with tm .assert_produces_warning (expected_warning = DeprecationWarning ,
2634
+ check_stacklevel = not compat .PY3 ):
2632
2635
result = store .select ('wp' , [('major_axis' ,'>' ,datetime .datetime (2000 ,1 ,2 ))])
2633
2636
expected = wp .loc [:,wp .major_axis > Timestamp ('20000102' )]
2634
2637
assert_panel_equal (result , expected )
2635
- with tm .assert_produces_warning (expected_warning = DeprecationWarning ):
2638
+ with tm .assert_produces_warning (expected_warning = DeprecationWarning ,
2639
+ check_stacklevel = not compat .PY3 ):
2636
2640
result = store .select ('wp' , [('major_axis' ,'>' ,datetime .datetime (2000 ,1 ,2 ,0 ,0 ))])
2637
2641
expected = wp .loc [:,wp .major_axis > Timestamp ('20000102' )]
2638
2642
assert_panel_equal (result , expected )
2639
- with tm .assert_produces_warning (expected_warning = DeprecationWarning ):
2643
+ with tm .assert_produces_warning (expected_warning = DeprecationWarning ,
2644
+ check_stacklevel = not compat .PY3 ):
2640
2645
result = store .select ('wp' , [('major_axis' ,'=' ,[datetime .datetime (2000 ,1 ,2 ,0 ,0 ),
2641
2646
datetime .datetime (2000 ,1 ,3 ,0 ,0 )])])
2642
2647
expected = wp .loc [:,[Timestamp ('20000102' ),Timestamp ('20000103' )]]
2643
2648
assert_panel_equal (result , expected )
2644
- with tm .assert_produces_warning (expected_warning = DeprecationWarning ):
2649
+ with tm .assert_produces_warning (expected_warning = DeprecationWarning ,
2650
+ check_stacklevel = not compat .PY3 ):
2645
2651
result = store .select ('wp' , [('minor_axis' ,'=' ,['A' ,'B' ])])
2646
2652
expected = wp .loc [:,:,['A' ,'B' ]]
2647
2653
assert_panel_equal (result , expected )
@@ -4528,7 +4534,7 @@ def f():
4528
4534
s = Series (np .random .randn (len (unicode_values )), unicode_values )
4529
4535
self ._check_roundtrip (s , tm .assert_series_equal )
4530
4536
4531
- compat_assert_produces_warning (PerformanceWarning ,f )
4537
+ compat_assert_produces_warning (PerformanceWarning , f )
4532
4538
4533
4539
def test_store_datetime_mixed (self ):
4534
4540
0 commit comments