Skip to content

Commit b95840f

Browse files
committed
Added test to reproduce issue pandas-dev#16583
1 parent 2e24a8f commit b95840f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/tests/io/test_pytables.py

+11
Original file line numberDiff line numberDiff line change
@@ -5247,6 +5247,17 @@ def test_query_compare_column_type(self):
52475247
expected = df.loc[[], :]
52485248
tm.assert_frame_equal(expected, result)
52495249

5250+
@pytest.mark.parametrize('format', ['fixed', 'table'])
5251+
def test_read_hdf_series_mode_r(self, format):
5252+
# GH 16583
5253+
# Tests that reading a Series saved to an HDF file
5254+
# still works if a mode='r' argument is supplied
5255+
series = tm.makeFloatSeries()
5256+
with ensure_clean_path(self.path) as path:
5257+
series.to_hdf(path, key='data', format=format)
5258+
result = pd.read_hdf(path, key='data', mode='r')
5259+
tm.assert_series_equal(result, series)
5260+
52505261
@pytest.mark.skipif(sys.version_info < (3, 6), reason="Need python 3.6")
52515262
def test_fspath(self):
52525263
with tm.ensure_clean('foo.h5') as path:

0 commit comments

Comments
 (0)