docstr: Test the lockstep mode by only adding SampleBatches.
  
  Such SampleBatches are converted to MultiAgent Batches as if there
  was only one policy.
docstr_tok: ["Test","the","lockstep","mode","by","only","adding","SampleBatches",".","Such","SampleBatches","are","converted","to","MultiAgent","Batches","as","if","there","was","only","one","policy","."]
code: def test_lockstep_mode(self):
      """Test the lockstep mode by only adding SampleBatches.
  
      Such SampleBatches are converted to MultiAgent Batches as if there
      was only one policy."""
      self.batch_id = 0
      batch_size = 5
      buffer_size = 30
  
      buffer = MultiAgentReplayBuffer(
          capacity=buffer_size,
          replay_mode="lockstep",
          num_shards=1,
      )
  
      # Test add/sample
      self._add_sample_batch_to_buffer(
          buffer, batch_size=batch_size, num_batches=1
      )
  
      # Sampling from it now should yield the first batch
      assert get_batch_id(buffer.sample(1)) == 0
  
      self._add_sample_batch_to_buffer(
          buffer, batch_size=batch_size, num_batches=2
      )
  
      # Sampling from it now should yield our first batch 1/3 of the time
      num_sampled_dict = {_id: 0 for _id in range(self.batch_id)}
      num_samples = 200
      for i in range(num_samples):
          _id = get_batch_id(buffer.sample(1))
          num_sampled_dict[_id] += 1
      assert np.allclose(
          np.array(list(num_sampled_dict.values())) / num_samples,
          len(num_sampled_dict) * [1 / 3],
          atol=0.1,
      )
  
file_path: ray/rllib/utils/replay_buffers/tests/test_multi_agent_replay_buffer.py
imports: import unittest
  import numpy
  from ray.rllib.policy.sample_batch import SampleBatch, MultiAgentBatch, concat_samples
  from ray.rllib.policy.sample_batch import DEFAULT_POLICY_ID
  from ray.rllib.utils.replay_buffers.multi_agent_replay_buffer import MultiAgentReplayBuffer
  from ray.rllib.utils.replay_buffers.prioritized_replay_buffer import PrioritizedReplayBuffer
  from ray.rllib.utils.replay_buffers.replay_buffer import ReplayBuffer
label_desc: Use image node_id 4 for calling the TestMultiAgentReplayBuffer obj's underlying member method code with example usage: obj.test_lockstep_mode() without return types