code: def test_store_hdf5_execution(setup):
      raw = np.random.RandomState(0).rand(10, 20)
  
      group_name = "test_group"
      dataset_name = "test_dataset"
  
      t1 = tensor(raw, chunk_size=20)
      t2 = tensor(raw, chunk_size=9)
  
      with pytest.raises(TypeError):
          tohdf5(object(), t2)
  
      with tempfile.TemporaryDirectory() as d:
          filename = os.path.join(
              d, f"test_store_{int(time.time())}.hdf5"
          )
  
          # test 1 chunk
          r = tohdf5(
              filename, t1, group=group_name, dataset=dataset_name
          )
          r.execute()
  
          with h5py.File(filename, "r") as f:
              result = np.asarray(f[f"{group_name}/{dataset_name}"])
              np.testing.assert_array_equal(result, raw)
  
          # test filename
          r = tohdf5(
              filename, t2, group=group_name, dataset=dataset_name
          )
          r.execute()
  
          with h5py.File(filename, "r") as f:
              result = np.asarray(f[f"{group_name}/{dataset_name}"])
              np.testing.assert_array_equal(result, raw)
  
          with pytest.raises(ValueError):
              tohdf5(filename, t2)
  
          with h5py.File(filename, "r") as f:
              # test file
              r = tohdf5(f, t2, group=group_name, dataset=dataset_name)
          r.execute()
  
          with h5py.File(filename, "r") as f:
              result = np.asarray(f[f"{group_name}/{dataset_name}"])
              np.testing.assert_array_equal(result, raw)
  
          with pytest.raises(ValueError):
              with h5py.File(filename, "r") as f:
                  tohdf5(f, t2)
  
          with h5py.File(filename, "r") as f:
              # test dataset
              ds = f[f"{group_name}/{dataset_name}"]
              # test file
              r = tohdf5(ds, t2)
          r.execute()
  
          with h5py.File(filename, "r") as f:
              result = np.asarray(f[f"{group_name}/{dataset_name}"])
              np.testing.assert_array_equal(result, raw)
  
file_path: mars/mars/tensor/datastore/tests/test_datastore_execution.py
imports: import os
  import shutil
  import tempfile
  import time
  import numpy
  import scipy.sparse
  import pytest
  from ...None import tensor, arange, totiledb, tohdf5, tozarr, tovineyard
  from ...datasource import fromvineyard
label_desc: Use image node_id 2 for calling a global function with example usage: test_store_hdf5_execution(setup) without return types