code: def test_hdf5_bool():
      """test_hdf5_bool: GitHub issue 1144"""
      runpath = tempfile.mkdtemp()
  
      boolean_data = np.asarray(
          [
              True,
              False,
              True,
              False,
              True,
              False,
              True,
              False,
              True,
              False,
          ]
      )
  
      with h5py.File(f"{runpath}/my_data.h5", "w") as h5_obj:
          h5_obj["my_bool_data"] = boolean_data
  
      with h5py.File(f"{runpath}/my_data.h5", "r") as h5_obj:
          print(
              h5_obj["my_bool_data"].shape, h5_obj["my_bool_data"].dtype
          )
  
      spec = {
          "/my_bool_data": tf.TensorSpec(shape=(None,), dtype=tf.bool)
      }
      h5_tensors = tfio.IOTensor.from_hdf5(
          f"{runpath}/my_data.h5", spec=spec
      )
  
      print("H5 DATA: ", h5_tensors("/my_bool_data").to_tensor())
  
      assert np.array_equal(
          boolean_data, h5_tensors("/my_bool_data").to_tensor()
      )
  
      mapping = {"SOLID": 0, "LIQUID": 1, "GAS": 2, "PLASMA": 3}
      dtype = h5py.special_dtype(enum=(np.int16, mapping))
      enum_data = np.asarray([0, 1, 2, 3])
  
      with h5py.File(f"{runpath}/my_enum_data.h5", "w") as h5_obj:
          dset = h5_obj.create_dataset("my_enum_data", [4], dtype=dtype)
          dset = enum_data
  
      with h5py.File(f"{runpath}/my_enum_data.h5", "r") as h5_obj:
          print(
              h5_obj["my_enum_data"].shape, h5_obj["my_enum_data"].dtype
          )
  
      spec = {
          "/my_enum_data": tf.TensorSpec(shape=(None,), dtype=tf.bool)
      }
      with pytest.raises(
          tf.errors.InvalidArgumentError,
          match=r".*unsupported data class for enum.*",
      ):
          h5_tensors = tfio.IOTensor.from_hdf5(
              f"{runpath}/my_enum_data.h5", spec=spec
          )
  
      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 4 for calling a global function with example usage: test_hdf5_bool() without return types