Combined h5_key tests in hdf5.py

This commit is contained in:
msauria
2019-05-17 09:56:43 -04:00
parent a563375610
commit 1ad49039a4
+1 -11
View File
@@ -24,17 +24,7 @@ def assert_has_h5_attribute(output_bytes, key, value):
def assert_has_h5_keys(output_bytes, keys):
""" Asserts the specified HDF5 output has exactly the given keys."""
_assert_h5py()
keys = [k.strip() for k in keys.strip().split(',')]
h5_keys = sorted(keys)
output_temp = io.BytesIO(output_bytes)
local_keys = sorted(list(h5py.File(output_temp, 'r').keys()))
assert local_keys == h5_keys, "Not a HDF5 file or H5 keys do not match:\n\t%s\n\t%s" % (local_keys, h5_keys)
def assert_contains_h5_keys(output_bytes, keys):
""" Asserts the specified HDF5 output contains the given keys, including recursive group paths."""
""" Asserts the specified HDF5 output has the given keys."""
_assert_h5py()
keys = [k.strip() for k in keys.strip().split(',')]
h5_keys = sorted(keys)