code: def test_eviction_policy(self):
      obs = np.array([[1], [1]])
      replay_buffer = PathBuffer(capacity_in_transitions=3)
      replay_buffer.add_path(dict(obs=obs))
  
      sampled_obs = replay_buffer.sample_transitions(3)["obs"]
      assert (sampled_obs == np.array([[1], [1], [1]])).all()
  
      sampled_path_obs = replay_buffer.sample_path()["obs"]
      assert (sampled_path_obs == np.array([[1], [1]])).all()
  
      obs2 = np.array([[2], [3]])
      replay_buffer.add_path(dict(obs=obs2))
  
      with pytest.raises(Exception):
          assert replay_buffer.add_path(dict(test_obs=obs2))
  
      obs3 = np.array([1])
      with pytest.raises(Exception):
          assert replay_buffer.add_path(dict(obs=obs3))
  
      obs4 = np.array([[4], [5], [6], [7]])
      with pytest.raises(Exception):
          assert replay_buffer.add_path(dict(obs=obs4))
  
      # Can still sample from old path
      new_sampled_obs = replay_buffer.sample_transitions(1000)["obs"]
      assert set(new_sampled_obs.flatten()) == {1, 2, 3}
  
      # Can't sample complete old path
      for _ in range(100):
          new_sampled_path_obs = replay_buffer.sample_path()["obs"]
          assert (new_sampled_path_obs == np.array([[2], [3]])).all()
  
      replay_buffer.clear()
      assert replay_buffer.n_transitions_stored == 0
      assert not replay_buffer._buffer
  
file_path: garage/tests/garage/replay_buffer/test_path_buffer.py
imports: import akro
  import numpy
  import pytest
  from garage import EnvSpec, EpisodeBatch, StepType
  from garage.replay_buffer import PathBuffer
  from tests.fixtures.envs.dummy import DummyDiscreteEnv
label_desc: Use image node_id 3 for calling the TestPathBuffer obj's underlying member method code with example usage: obj.test_eviction_policy() without return types