diff --git a/tests/make_new_style_groups_file.py b/tests/make_new_style_groups_file.py new file mode 100644 index 0000000..9e55cb4 --- /dev/null +++ b/tests/make_new_style_groups_file.py @@ -0,0 +1,9 @@ +#! /usr/bin/env python +""" Create a HDF5 file with new-style groups. """ +import h5py +import numpy as np + + +f = h5py.File('new_style_groups.hdf5', 'w', track_order=True) +for i in range(9): + f.create_group('group' + str(i)) diff --git a/tests/new_style_groups.hdf5 b/tests/new_style_groups.hdf5 new file mode 100644 index 0000000..555a1c7 Binary files /dev/null and b/tests/new_style_groups.hdf5 differ diff --git a/tests/test_new_style_groups.py b/tests/test_new_style_groups.py new file mode 100644 index 0000000..71b9ee3 --- /dev/null +++ b/tests/test_new_style_groups.py @@ -0,0 +1,23 @@ +""" Test new style groups in pyfive. """ +import os + +import pyfive + +DIRNAME = os.path.dirname(__file__) +NEW_STYLE_GROUPS_HDF5_FILE = os.path.join(DIRNAME, 'new_style_groups.hdf5') + + +def test_groups(): + + with pyfive.File(NEW_STYLE_GROUPS_HDF5_FILE) as hfile: + + assert len(hfile) == 9 + grp0 = hfile['group0'] + grp1 = hfile['group1'] + grp2 = hfile['group2'] + grp3 = hfile['group3'] + grp4 = hfile['group4'] + grp5 = hfile['group5'] + grp6 = hfile['group6'] + grp7 = hfile['group7'] + grp8 = hfile['group8']