code: def test_last_transition_corresponds_to_source_dataset(self):
      dataset = _build_dataset(self.dataset_dir)
      # Get the final observation of the first episode directly from the file.
      with h5py.File(self.dataset_dir, "r") as ds_file:
          raw_last_obs = {}
          for key, item in ds_file["data"]["demo_1"][
              "next_obs"
          ].items():
              raw_last_obs[key] = item[-1]
  
      # Get final observation of the first episode from the iterator.
      for el in dataset:
          ds_last_obs = {}
          for key, item in el["steps"]["observation"].items():
              ds_last_obs[key] = item[-1]
          break
  
      # As these are dicts of arrays need to run comparison by hand or we will
      # have a complaint about truth value of an array.
      equality = np.array(
          tree.flatten(
              tree.map_structure(
                  lambda a, b: (a == b).all(), ds_last_obs, raw_last_obs
              )
          )
      ).all()
      self.assertTrue(equality)
  
file_path: datasets/tensorflow_datasets/robomimic/dataset_utils_test.py
imports: import inspect
  import os
  from absl import flags
  from absl.testing import absltest
  from etils import epath
  import h5py
  import numpy
  from tensorflow_datasets.robomimic import dataset_utils
  import tree
label_desc: Use image node_id 2 for calling the DatasetUtilsTest obj's underlying member method code with example usage: obj.test_last_transition_corresponds_to_source_dataset() without return types