Skip to content

Commit b3a5773

Browse files
committed
Add test that fails for GitHub bug pandas-dev#13231
1 parent 02f90d5 commit b3a5773

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

pandas/io/tests/test_pytables.py

+13
Original file line numberDiff line numberDiff line change
@@ -4877,13 +4877,26 @@ def test_read_nokey(self):
48774877
df = DataFrame(np.random.rand(4, 5),
48784878
index=list('abcd'),
48794879
columns=list('ABCDE'))
4880+
# Categorical dtype not supported for "fixed" format. So no need
4881+
# to test for that.
48804882
with ensure_clean_path(self.path) as path:
48814883
df.to_hdf(path, 'df', mode='a')
48824884
reread = read_hdf(path)
48834885
assert_frame_equal(df, reread)
48844886
df.to_hdf(path, 'df2', mode='a')
48854887
self.assertRaises(ValueError, read_hdf, path)
48864888

4889+
def test_read_nokey_table(self):
4890+
# GH13231
4891+
df = DataFrame({'i': range(5),
4892+
'c': Series(list('abacd'), dtype='category')})
4893+
with ensure_clean_path(self.path) as path:
4894+
df.to_hdf(path, 'df', mode='a', format='table')
4895+
reread = read_hdf(path)
4896+
assert_frame_equal(df, reread)
4897+
df.to_hdf(path, 'df2', mode='a', format='table')
4898+
self.assertRaises(ValueError, read_hdf, path)
4899+
48874900
def test_read_from_pathlib_path(self):
48884901

48894902
# GH11773

0 commit comments

Comments
 (0)