code: def test_metadata(self):
      with testing.tmp_dir(self.get_temp_dir()) as tmp_dir:
          builder = RandomShapedImageGenerator(data_dir=tmp_dir)
          builder.download_and_prepare()
          # Metadata should have been created
          self.assertEqual(builder.info.metadata, {"some_key": 123})
  
          # Metadata should have been restored
          builder2 = RandomShapedImageGenerator(data_dir=tmp_dir)
          self.assertEqual(builder2.info.metadata, {"some_key": 123})
  
          # Metadata should have been restored even if the builder code was not
          # available and we restored from files.
          builder3 = read_only_builder.builder_from_files(
              builder.name,
              data_dir=tmp_dir,
          )
          self.assertEqual(builder3.info.metadata, {"some_key": 123})
  
imports: import json
  import os
  import pathlib
  import tempfile
  import time
  from typing import Union
  import numpy
  import pytest
  import tensorflow
  from tensorflow_datasets import testing
  from tensorflow_datasets.core import dataset_builder
  from tensorflow_datasets.core import dataset_info
  from tensorflow_datasets.core import features
  from tensorflow_datasets.core import file_adapters
  from tensorflow_datasets.core import naming
  from tensorflow_datasets.core import read_only_builder
  from tensorflow_datasets.core import splits
  from tensorflow_datasets.core import utils
  from tensorflow_datasets.core.proto import dataset_info_pb2
  from tensorflow_datasets.core.proto import feature_pb2
  from tensorflow_datasets.image_classification import mnist
  from tensorflow_datasets.testing.dummy_config_based_datasets.dummy_ds_1 import dummy_ds_1_dataset_builder
  from google.protobuf import text_format
label_desc: Use image node_id 12 for calling the DatasetInfoTest obj's underlying member method code with example usage: obj.test_metadata() without return types