code: def test_op_saves_and_restores_its_state(self) -> None:
      pipeline1 = read_sequence([1, 2, 3, 4]).and_return()
      pipeline2 = read_sequence([5, 6]).and_return()
      pipeline3 = read_sequence([]).and_return()
      pipeline4 = read_sequence([7, 8, 9, 0, 1, 2]).and_return()
  
      pipeline = DataPipeline.round_robin(
          [pipeline1, pipeline2, pipeline3, pipeline4]
      ).and_return()
  
      d = None
  
      it = iter(pipeline)
  
      # Move to the fifth example.
      for _ in range(5):
          d = next(it)
  
      assert d == 6
  
      state_dict = pipeline.state_dict()
  
      # Read a few examples before we roll back.
      for _ in range(4):
          d = next(it)
  
      assert d == 9
  
      # Expected to roll back to the fifth example.
      pipeline.load_state_dict(state_dict)
  
      # Move to EOD.
      for _ in range(13):
          d = next(it)
  
      assert d == 2
  
      state_dict = pipeline.state_dict()
  
      pipeline.reset()
  
      # Expected to be EOD.
      pipeline.load_state_dict(state_dict)
  
      with pytest.raises(StopIteration):
          next(iter(pipeline))
  
file_path: fairseq2/tests/unit/data/data_pipeline/test_round_robin.py
imports: import pytest
  from fairseq2.data import DataPipeline, DataPipelineError, read_sequence
  from fairseq2.data.text import read_text
label_desc: Use image node_id 9 for calling the TestRoundRobinOp obj's underlying member method code with example usage: obj.test_op_saves_and_restores_its_state() without return types