class_docstr: A simple generic test environment.
  
  This class is a lightweight implementation of `environment.Base` that returns
  the same timesteps on every observation call. By default, each returned
  timestep (one per agent) is reward 0., discount 1., and the observations are
  zero `np.ndarrays` of dtype `np.int32` and the shape specified by the
  environment's spec.
  
  However, the behavior of the `TestEnvironment` can be configured using the
  object's attributes.
  
  Attributes:
    next_timestep: The `environment.TimeStep`s to return on the next call to
      `step`. When necessary, some fields will be overridden to ensure the
      `step_type` contract.
    episode_length: if the episode length (number of transitions) exceeds
      `episode_length` on a call to `step`, the `step-type` will be set to
      `environment.StepType.LAST`, forcing an end of episode. This allows a
      stub of a production environment to have end_episodes. Will be ignored if
      set to `float('inf')` (the default).
class_docstr_tok: ["A","simple","generic","test","environment",".","This","class","is","a","lightweight","implementation","of","`","environment.Base","`","that","returns","the","same","timesteps","on","every","observation","call",".","By","default",",","each","returned","timestep","(","one","per","agent",")","is","reward","0.",",","discount","1.",",","and","the","observations","are","zero","`","np.ndarrays","`","of","dtype","`","np.int32","`","and","the","shape","specified","by","the","environment","'s","spec",".","However",",","the","behavior","of","the","`","TestEnvironment","`","can","be","configured","using","the","object","'s","attributes",".","Attributes",":","next_timestep",":","The","`","environment.TimeStep","`","s","to","return","on","the","next","call","to","`","step","`",".","When","necessary",",","some","fields","will","be","overridden","to","ensure","the","`","step_type","`","contract",".","episode_length",":","if","the","episode","length","(","number","of","transitions",")","exceeds","`","episode_length","`","on","a","call","to","`","step","`",",","the","`","step-type","`","will","be","set","to","`","environment.StepType.LAST","`",",","forcing","an","end","of","episode",".","This","allows","a","stub","of","a","production","environment","to","have","end_episodes",".","Will","be","ignored","if","set","to","`","float","(","'inf","'",")","`","(","the","default",")","."]
docstr: Initializes the TestEnvironment.
  
  The `next_observation` is initialized to be reward = 0., discount = 1.,
  and an appropriately sized observation of all zeros. `episode_length` is set
  to `float('inf')`.
  
  Args:
    num_agents: The number of agents.
    observation_spec: The observation specs for each player.
    action_spec: The action specs for each player.
docstr_tok: ["Initializes","the","TestEnvironment",".","The","`","next_observation","`","is","initialized","to","be","reward","=","0.",",","discount","=","1.",",","and","an","appropriately","sized","observation","of","all","zeros",".","`","episode_length","`","is","set","to","`","float","(","'inf","'",")","`",".","Args",":","num_agents",":","The","number","of","agents",".","observation_spec",":","The","observation","specs","for","each","player",".","action_spec",":","The","action","specs","for","each","player","."]
code: def __init__(self, num_agents, observation_spec, action_spec):
      """Initializes the TestEnvironment.
  
      The `next_observation` is initialized to be reward = 0., discount = 1.,
      and an appropriately sized observation of all zeros. `episode_length` is set
      to `float('inf')`.
  
      Args:
        num_agents: The number of agents.
        observation_spec: The observation specs for each player.
        action_spec: The action specs for each player.
      """
      self._num_agents = num_agents
      self._observation_spec = observation_spec
      self._action_spec = action_spec
      self._episode_steps = 0
  
      self.next_timestep = []
      for agent_index, obs_spec in enumerate(observation_spec):
          self.next_timestep.append(
              environment.TimeStep(
                  step_type=environment.StepType.MID,
                  reward=0.0,
                  discount=1.0,
                  observation=self._default_observation(
                      obs_spec, agent_index
                  ),
              )
          )
  
      self.episode_length = float("inf")
  
imports: import numpy
  from pysc2.env import environment
  from pysc2.env import sc2_env
  from pysc2.lib import features
  from pysc2.lib import units
  from pysc2.tests import dummy_observation
  from s2clientprotocol import common_pb2
  from s2clientprotocol import raw_pb2
  from s2clientprotocol import sc2api_pb2
label_desc: Use image node_id 1 to create a new _TestEnvironment object from inherited base classes: environment with example: obj = _TestEnvironment(num_agents, observation_spec, action_spec)