code: def setUp(self):
      super().setUp()
      self._source_data_dir = os.path.join(
          os.path.dirname(os.path.dirname(__file__)), "testdata"
      )
      self._output_data_dir = os.path.join(
          os.environ.get(
              "TEST_UNDECLARED_OUTPUTS_DIR", self.get_temp_dir()
          ),
          self._testMethodName,
      )
  
      # Create input dict.
      e1 = standard_artifacts.Examples()
      e1.uri = os.path.join(
          self._source_data_dir, "transform/transformed_examples"
      )
      e1.split_names = artifact_utils.encode_split_names(
          ["train", "eval"]
      )
  
      e2 = copy.deepcopy(e1)
  
      self._single_artifact = [e1]
      self._multiple_artifacts = [e1, e2]
  
      transform_graph = standard_artifacts.TransformGraph()
      transform_graph.uri = os.path.join(
          self._source_data_dir, "transform/transform_graph"
      )
  
      schema = standard_artifacts.Schema()
      schema.uri = os.path.join(self._source_data_dir, "schema_gen")
      previous_model = standard_artifacts.Model()
      previous_model.uri = os.path.join(
          self._source_data_dir, "trainer/previous"
      )
  
      self._input_dict = {
          standard_component_specs.EXAMPLES_KEY: self._single_artifact,
          standard_component_specs.TRANSFORM_GRAPH_KEY: [
              transform_graph
          ],
          standard_component_specs.SCHEMA_KEY: [schema],
          standard_component_specs.BASE_MODEL_KEY: [previous_model],
      }
  
      # Create output dict.
      self._model_exports = standard_artifacts.Model()
      self._model_exports.uri = os.path.join(
          self._output_data_dir, "model_export_path"
      )
      self._model_run_exports = standard_artifacts.ModelRun()
      self._model_run_exports.uri = os.path.join(
          self._output_data_dir, "model_run_path"
      )
      self._output_dict = {
          standard_component_specs.MODEL_KEY: [self._model_exports],
          standard_component_specs.MODEL_RUN_KEY: [
              self._model_run_exports
          ],
      }
  
      # Create exec properties skeleton.
      self._exec_properties = {
          standard_component_specs.TRAIN_ARGS_KEY: proto_utils.proto_to_json(
              trainer_pb2.TrainArgs(num_steps=1000)
          ),
          standard_component_specs.EVAL_ARGS_KEY: proto_utils.proto_to_json(
              trainer_pb2.EvalArgs(num_steps=500)
          ),
          "warm_starting": False,
      }
  
      self._module_file = os.path.join(
          self._source_data_dir,
          standard_component_specs.MODULE_FILE_KEY,
          "trainer_module.py",
      )
      self._trainer_fn = name_utils.get_full_name(
          trainer_module.trainer_fn
      )
  
      # Executors for test.
      self._trainer_executor = executor.Executor()
      self._generic_trainer_executor = executor.GenericExecutor()
  
imports: import copy
  import json
  import os
  from unittest import mock
  import tensorflow
  from tfx.components.testdata.module_file import trainer_module
  from tfx.components.trainer import executor
  from tfx.dsl.io import fileio
  from tfx.proto import trainer_pb2
  from tfx.types import artifact_utils
  from tfx.types import standard_artifacts
  from tfx.types import standard_component_specs
  from tfx.utils import io_utils
  from tfx.utils import name_utils
  from tfx.utils import path_utils
  from tfx.utils import proto_utils
label_desc: Use image node_id 1 for calling the ExecutorTest obj's underlying member method code with example usage: obj.setUp() without return types