Skip to content

Commit 2d9451d

Browse files
authored
DEPR: more deprecation warnings (#16001)
1 parent 614a48e commit 2d9451d

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

pandas/tests/io/test_pytables.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,20 +150,23 @@ class TestHDFStore(Base, tm.TestCase):
150150
def test_factory_fun(self):
151151
path = create_tempfile(self.path)
152152
try:
153-
with get_store(path) as tbl:
154-
raise ValueError('blah')
153+
with catch_warnings(record=True):
154+
with get_store(path) as tbl:
155+
raise ValueError('blah')
155156
except ValueError:
156157
pass
157158
finally:
158159
safe_remove(path)
159160

160161
try:
161-
with get_store(path) as tbl:
162-
tbl['a'] = tm.makeDataFrame()
162+
with catch_warnings(record=True):
163+
with get_store(path) as tbl:
164+
tbl['a'] = tm.makeDataFrame()
163165

164-
with get_store(path) as tbl:
165-
self.assertEqual(len(tbl), 1)
166-
self.assertEqual(type(tbl['a']), DataFrame)
166+
with catch_warnings(record=True):
167+
with get_store(path) as tbl:
168+
self.assertEqual(len(tbl), 1)
169+
self.assertEqual(type(tbl['a']), DataFrame)
167170
finally:
168171
safe_remove(self.path)
169172

@@ -348,7 +351,7 @@ def test_api_default_format(self):
348351

349352
pandas.set_option('io.hdf.default_format', 'fixed')
350353
df.to_hdf(path, 'df')
351-
with get_store(path) as store:
354+
with HDFStore(path) as store:
352355
self.assertFalse(store.get_storer('df').is_table)
353356
self.assertRaises(ValueError, df.to_hdf, path, 'df2', append=True)
354357

pandas/tests/io/test_sql.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
"""
1919

2020
from __future__ import print_function
21+
from warnings import catch_warnings
2122
import pytest
2223
import unittest
2324
import sqlite3
@@ -586,9 +587,10 @@ def test_to_sql_series(self):
586587
tm.assert_frame_equal(s.to_frame(), s2)
587588

588589
def test_to_sql_panel(self):
589-
panel = tm.makePanel()
590-
self.assertRaises(NotImplementedError, sql.to_sql, panel,
591-
'test_panel', self.conn)
590+
with catch_warnings(record=True):
591+
panel = tm.makePanel()
592+
self.assertRaises(NotImplementedError, sql.to_sql, panel,
593+
'test_panel', self.conn)
592594

593595
def test_roundtrip(self):
594596
sql.to_sql(self.test_frame1, 'test_frame_roundtrip',

0 commit comments

Comments
 (0)