code: def test_copy_observations():
      methods = [
          "fit",
          "test",
      ]
  
      for method in methods:
          original_observations = []
  
          class LocalEnv(Env):
              def __init__(self):
                  super(LocalEnv, self).__init__()
  
              def step(self, action):
                  self.state += 1
                  done = self.state >= 6
                  reward = float(self.state) / 10.0
                  obs = np.array(self.state)
                  original_observations.append(obs)
                  return obs, reward, done, {}
  
              def reset(self):
                  self.state = 1
                  return np.array(self.state)
  
              def seed(self, seed=None):
                  pass
  
              def configure(self, *args, **kwargs):
                  pass
  
          # Slight abuse of the processor for test purposes.
          observations = []
  
          class LocalProcessor(Processor):
              def process_step(self, observation, reward, done, info):
                  observations.append(observation)
                  return observation, reward, done, info
  
          processor = LocalProcessor()
          memory = SequentialMemory(100, window_length=1)
          agent = TestAgent(memory, processor=processor)
          env = LocalEnv()
          agent.compile()
          getattr(agent, method)(env, 20, verbose=0, visualize=False)
  
          assert len(observations) == len(original_observations)
          assert_allclose(
              np.array(observations), np.array(original_observations)
          )
          assert np.all(
              [
                  o is not o_
                  for o, o_ in zip(original_observations, observations)
              ]
          )
  
imports: from __future__ import division
  import pytest
  import numpy
  from numpy.testing import assert_allclose
  from rl.memory import SequentialMemory
  from rl.core import Agent, Env, Processor
label_desc: Use image node_id 2 for calling a global function with example usage: test_copy_observations() and returns: obs,  reward,  done,  dict, np, observation,  reward,  done,  info