Skip to content

Commit

Permalink
add test for zero extent dataset (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
jreadey authored Dec 13, 2024
1 parent 6b16e98 commit 0b20fcd
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
6 changes: 3 additions & 3 deletions h5pyd/_apps/hsinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ def getUpTime(start_time):
if days:
ret_str = f"{days} days, {hrs} hours {mins} min {sec} sec"
elif hrs:
ret_str = f"{hrs} hours {min} min {sec} sec"
ret_str = f"{hrs} hours {mins} min {sec} sec"
elif mins:
ret_str = f"{min} min {sec} sec"
ret_str = f"{mins} min {sec} sec"
else:
ret_str = "{sec} sec"
ret_str = f"{sec} sec"

return ret_str

Expand Down
18 changes: 18 additions & 0 deletions test/hl/test_dataset_extend.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,24 @@ def test_extend_dset(self):

f.close()

def test_extend_multidim_dset(self):
filename = self.getFileName("extend_multidim_dset")
print("filename:", filename)
f = h5py.File(filename, "w")

dset = f.create_dataset('dset', (0, 3, 0), maxshape=(None, 3, None), dtype='i8')

maxshape = dset.maxshape
self.assertEqual(maxshape, (None, 3, None))

# extend first dimension of dataset
dset.resize(2, axis=0)

shape = dset.shape
self.assertEqual(shape, (2, 3, 0))

f.close()


if __name__ == '__main__':
loglevel = logging.ERROR
Expand Down

0 comments on commit 0b20fcd

Please sign in to comment.