code: def _check_all_goals_hit_by_opt_and_batchsize(
      self,
      opt,
      batchsize,
      num_episodes,
      target_all_goals_hit,
      target_metrics_length=None,
  ):
      opt = copy.deepcopy(opt)
      opt["batchsize"] = batchsize
      opt["num_episodes"] = num_episodes
      report, metrics = self._run_opt_get_report(opt)
      self.assertEqual(
          report.get("all_goals_hit"), target_all_goals_hit
      )
      metrics_comp_length = num_episodes
      if target_metrics_length:
          metrics_comp_length = target_metrics_length
      self.assertEqual(len(metrics), metrics_comp_length)
  
imports: import copy
  import unittest
  from parlai.core.metrics import dict_report
  from parlai.core.opt import Opt
  from parlai.core.tod.tod_core import SerializationHelpers
  import parlai.core.tod.tod_test_utils.test_agents
  from parlai.core.tod.world_metrics_handlers import METRICS_HANDLER_CLASSES_TEST_REGISTRY
  import parlai.scripts.tod_world_script
  import projects.tod_simulator.world_metrics.extended_world_metrics
label_desc: Use image node_id 5 for calling the TodMetricsInScriptTests obj's underlying member method code with example usage: obj._check_all_goals_hit_by_opt_and_batchsize(opt, batchsize, num_episodes, target_all_goals_hit, target_metrics_length) without return types