code: def test_during_iter(self):
      dataset = TorchNormalDataset(num_of_data=100)
      sampler = RandomSampler(dataset)
      for i in sampler:
          with pytest.raises(AssertionError):
              sampler.set_distributed(1, 0)
          break
  
      #  should not raise
      for i in sampler:
          pass
      sampler.set_distributed(1, 0)
  
imports: import numpy
  import pytest
  from functools import partial
  from itertools import chain
  from copy import deepcopy
  from fastNLP.core.samplers.reproducible_sampler import RandomSampler, SortedSampler, SequentialSampler
  from tests.helpers.datasets.torch_data import TorchNormalDataset
label_desc: Use image node_id 2 for calling the TestRandomSamplerYh obj's underlying member method code with example usage: obj.test_during_iter() without return types