code: def test_hdf5():
      """test_hdf5: GitHub issue 841"""
  
      def create_datasets(runpath, cnt=10):
          os.makedirs(runpath, exist_ok=True)
          for i in range(cnt):
              f = h5py.File(f"{runpath}/file_{i}.h5", "w")
              total_samples = np.random.randint(50000, 100000)
              f.create_dataset(
                  "features", data=np.random.random((total_samples, 60))
              )
              f.create_dataset(
                  "targets", data=np.random.random((total_samples, 3))
              )
              f.close()
  
      runpath = tempfile.mkdtemp()
      create_datasets(runpath)
  
      for i in range(2):
          cnt = 0
          for p in glob.glob(f"{runpath}/*.h5"):
              try:
                  features = tfio.IODataset.from_hdf5(p, "/features")
                  targets = tfio.IODataset.from_hdf5(p, "/targets")
                  dataset = tf.data.Dataset.zip((features, targets))
  
                  for t in dataset:
                      cnt += t[0].shape[0]
  
              except Exception as e:
                  print(f"Failed going through {p}")
                  raise e
              print(f"Success going through {p}")
  
      print(f"Iterated {cnt} items")
  
      shutil.rmtree(runpath)
  
file_path: io/tests/test_hdf5.py
imports: import os
  import glob
  import shutil
  import tempfile
  import numpy
  import h5py
  import pytest
  import tensorflow
  import tensorflow_io
label_desc: Use image node_id 1 for calling a global function with example usage: test_hdf5() without return types