code: def test_append_and_pop(self):
      buffer = BufferWithInfiniteLookback(data=[0, 1, 2, 3])
      self.assertTrue(len(buffer), 4)
      buffer.append(4)
      self.assertTrue(len(buffer), 5)
      buffer.append(5)
      self.assertTrue(len(buffer), 6)
      buffer.pop()
      self.assertTrue(len(buffer), 5)
      buffer.pop()
      self.assertTrue(len(buffer), 4)
      buffer.append(10)
      self.assertTrue(len(buffer), 5)
      check(buffer.data, [0, 1, 2, 3, 10])
      buffer.finalize()
  
      # Even after finalizing, we can still add data to the buffer.
      buffer.append(11)
      self.assertTrue(buffer.get(indices=-1) == 11)
      test = buffer.get(indices=[-2, -1])
      self.assertTrue(np.all(test == np.array([10, 11])))
      self.assertTrue(isinstance(test, np.ndarray))
  
      buffer.extend([12, 13])
      self.assertTrue(buffer.get(indices=-1) == 13)
      test = buffer.get(indices=[-2, -1])
      self.assertTrue(np.all(test == np.array([12, 13])))
      self.assertTrue(isinstance(test, np.ndarray))
  
      buffer.pop()
      self.assertTrue(buffer.get(indices=-1) == 12)
      self.assertTrue(buffer.get(indices=0) == 0)
  
file_path: ray/rllib/env/tests/test_lookback_buffer.py
imports: import unittest
  import gymnasium
  import numpy
  from ray.rllib.env.utils import BufferWithInfiniteLookback
  from ray.rllib.utils.spaces.space_utils import batch, get_dummy_batch_for_space
  from ray.rllib.utils.test_utils import check
label_desc: Use image node_id 1 for calling the TestBufferWithInfiniteLookback obj's underlying member method code with example usage: obj.test_append_and_pop() without return types