code: def testEpisodeLength(self):
      action_spec = [
          array_spec.BoundedArraySpec((2, 2), np.int32, -10, 10),
          array_spec.BoundedArraySpec((1, 2), np.int32, -10, 10),
      ]
  
      action_script = [
          (
              1,
              [
                  np.array([[5, 2], [1, 3]], dtype=np.int32),
                  np.array([[4, 6]], dtype=np.int32),
              ],
          ),
          (
              2,
              [
                  np.array([[1, 2], [3, 4]], dtype=np.int32),
                  np.array([[5, 6]], dtype=np.int32),
              ],
          ),
      ]
  
      policy = scripted_py_policy.ScriptedPyPolicy(
          time_step_spec=self._time_step_spec,
          action_spec=action_spec,
          action_script=action_script,
      )
      policy_state = policy.get_initial_state()
  
      action_step = policy.action(self._time_step, policy_state)
      self.assertEqual(action_script[0][1], action_step.action)
      action_step = policy.action(self._time_step, action_step.state)
      self.assertEqual(action_script[1][1], action_step.action)
      action_step = policy.action(self._time_step, action_step.state)
      self.assertEqual(action_script[1][1], action_step.action)
      with self.assertRaisesRegexp(
          ValueError, ".*Episode is longer than.*"
      ):
          policy.action(self._time_step, action_step.state)
  
file_path: agents/tf_agents/policies/scripted_py_policy_test.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  from tf_agents.policies import scripted_py_policy
  from tf_agents.specs import array_spec
  from tf_agents.trajectories import time_step
  from tf_agents.utils import test_utils
label_desc: Use image node_id 6 for calling the ScriptedPyPolicyTest obj's underlying member method code with example usage: obj.testEpisodeLength() without return types