class_docstr: Modified tests from dopamine run_experiment_test.py.
class_docstr_tok: ["Modified","tests","from","dopamine","run_experiment_test.py","."]
code: def testRunOnePhase(self):
      batch_size = self.batch_size
      environment_steps = 2
      max_steps = environment_steps * batch_size * 10
  
      envs = [
          MockEnvironment(max_steps=environment_steps)
          for _ in range(batch_size)
      ]
  
      environment = BatchEnv(envs)
      runner = dopamine_connector.BatchRunner(
          self._test_subdir,
          self._create_agent_fn,
          create_environment_fn=lambda: environment,
      )
  
      statistics = []
  
      step_number, sum_returns, num_episodes = runner._run_one_phase(
          max_steps, statistics, "test"
      )
      calls_to_run_episode = int(
          max_steps / (environment_steps * batch_size)
      )
      self.assertEqual(
          self._agent.step.call_count, calls_to_run_episode
      )
      self.assertEqual(
          self._agent.end_episode.call_count, calls_to_run_episode
      )
      self.assertEqual(max_steps, step_number)
      self.assertEqual(
          -1 * calls_to_run_episode * batch_size, sum_returns
      )
      self.assertEqual(calls_to_run_episode, num_episodes / batch_size)
      expected_statistics = []
      for _ in range(calls_to_run_episode * batch_size):
          expected_statistics.append(
              {"test_episode_lengths": 2, "test_episode_returns": -1}
          )
      self.assertEqual(len(expected_statistics), len(statistics))
      for expected_stats, stats in zip(expected_statistics, statistics):
          self.assertDictEqual(expected_stats, stats)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import shutil
  from absl import flags
  from dopamine.discrete_domains import logger
  import mock
  import numpy
  from tensor2tensor.rl import dopamine_connector
  import tensorflow.compat.v1
label_desc: Use image node_id 6 for calling the BatchedRunnerTest obj's underlying member method code with example usage: obj.testRunOnePhase() without return types