Skip to content

Commit 3ca1afe

Browse files
author
hugo
committed
TST: checked for DeprecationWarning on tests for backwards compatability logic
1 parent a608e14 commit 3ca1afe

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

pandas/io/tests/test_pytables.py

+13-11
Original file line numberDiff line numberDiff line change
@@ -2481,9 +2481,9 @@ def test_backwards_compat_without_term_object(self):
24812481
major_axis=date_range('1/1/2000', periods=5),
24822482
minor_axis=['A', 'B', 'C', 'D'])
24832483
store.append('wp',wp)
2484-
2485-
result = store.select('wp', [('major_axis>20000102'),
2486-
('minor_axis', '=', ['A','B']) ])
2484+
with tm.assert_produces_warning(expected_warning=DeprecationWarning):
2485+
result = store.select('wp', [('major_axis>20000102'),
2486+
('minor_axis', '=', ['A','B']) ])
24872487
expected = wp.loc[:,wp.major_axis>Timestamp('20000102'),['A','B']]
24882488
assert_panel_equal(result, expected)
24892489

@@ -2500,22 +2500,24 @@ def test_backwards_compat_without_term_object(self):
25002500
store.append('wp',wp)
25012501

25022502
# stringified datetimes
2503-
result = store.select('wp', [('major_axis','>',datetime.datetime(2000,1,2))])
2503+
with tm.assert_produces_warning(expected_warning=DeprecationWarning):
2504+
result = store.select('wp', [('major_axis','>',datetime.datetime(2000,1,2))])
25042505
expected = wp.loc[:,wp.major_axis>Timestamp('20000102')]
25052506
assert_panel_equal(result, expected)
2506-
2507-
result = store.select('wp', [('major_axis','>',datetime.datetime(2000,1,2,0,0))])
2507+
with tm.assert_produces_warning(expected_warning=DeprecationWarning):
2508+
result = store.select('wp', [('major_axis','>',datetime.datetime(2000,1,2,0,0))])
25082509
expected = wp.loc[:,wp.major_axis>Timestamp('20000102')]
25092510
assert_panel_equal(result, expected)
2510-
2511-
result = store.select('wp', [('major_axis','=',[datetime.datetime(2000,1,2,0,0),datetime.datetime(2000,1,3,0,0)])])
2511+
with tm.assert_produces_warning(expected_warning=DeprecationWarning):
2512+
result = store.select('wp', [('major_axis','=',[datetime.datetime(2000,1,2,0,0),
2513+
datetime.datetime(2000,1,3,0,0)])])
25122514
expected = wp.loc[:,[Timestamp('20000102'),Timestamp('20000103')]]
25132515
assert_panel_equal(result, expected)
2514-
2515-
result = store.select('wp', [('minor_axis','=',['A','B'])])
2516+
with tm.assert_produces_warning(expected_warning=DeprecationWarning):
2517+
result = store.select('wp', [('minor_axis','=',['A','B'])])
25162518
expected = wp.loc[:,:,['A','B']]
25172519
assert_panel_equal(result, expected)
2518-
2520+
25192521
def test_same_name_scoping(self):
25202522

25212523
with ensure_clean_store(self.path) as store:

0 commit comments

Comments
 (0)