Skip to content

Commit

Permalink
add test for new style groups
Browse files Browse the repository at this point in the history
This test currently fails.
  • Loading branch information
jjhelmus authored and woutdenolf committed Jul 12, 2021
1 parent f3683c0 commit c9441d6
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/make_new_style_groups_file.py
Original file line number Diff line number Diff line change
@@ -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))
Binary file added tests/new_style_groups.hdf5
Binary file not shown.
23 changes: 23 additions & 0 deletions tests/test_new_style_groups.py
Original file line number Diff line number Diff line change
@@ -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']

0 comments on commit c9441d6

Please sign in to comment.