class_docstr: Unit-test base class.
class_docstr_tok: ["Unit-test","base","class","."]
docstr: Generic unit-test preparation.
docstr_tok: ["Generic","unit-test","preparation","."]
code: def prepare(
      self, environment=None, states=None, actions=None, **agent
  ):
      """
      Generic unit-test preparation.
      """
      if environment is None:
          environment = self.environment_spec(
              states=states, actions=actions
          )
          environment = Environment.create(environment=environment)
  
      else:
          environment = Environment.create(
              environment=environment,
              max_episode_timesteps=self.__class__.max_episode_timesteps,
          )
  
      agent = self.agent_spec(**agent)
  
      agent = Agent.create(agent=agent, environment=environment)
      assert agent.__class__.__name__ in (
          "ConstantAgent",
          "RandomAgent",
      ) or isinstance(agent.model.get_architecture(), str)
  
      return agent, environment
  
file_path: tensorforce/test/unittest_base.py
imports: from copy import deepcopy
  from datetime import datetime
  import sys
  from tensorforce import Agent, Environment, Runner
  from test.unittest_environment import UnittestEnvironment
label_desc: Use image node_id 5 for calling the UnittestBase obj's underlying member method code with example usage: obj.prepare(environment, states, actions) and returns: agent,  environment