class_docstr: 专门测试 set_dist_repro_dataloader 函数的类
class_docstr_tok: ["\u4e13\u95e8\u6d4b\u8bd5","set_dist_repro_dataloader","\u51fd\u6570\u7684\u7c7b"]
docstr: 测试 set_dist_repro_dataloader 参数 dist 不是字符串时的表现，且 dist 是 ReproducibleBatchSampler
  应该返回新的 dataloader，并将 batch_sampler 替换为 dist 对应的 Sampler
docstr_tok: ["\u6d4b\u8bd5","set_dist_repro_dataloader","\u53c2\u6570","dist","\u4e0d\u662f\u5b57\u7b26\u4e32\u65f6\u7684\u8868\u73b0\uff0c\u4e14","dist","\u662f","ReproducibleBatchSampler","\u5e94\u8be5\u8fd4\u56de\u65b0\u7684","dataloader\uff0c\u5e76\u5c06","batch_sampler","\u66ff\u6362\u4e3a","dist","\u5bf9\u5e94\u7684","Sampler"]
code: def test_with_dist_batch_sampler(self, shuffle):
      """
      测试 set_dist_repro_dataloader 参数 dist 不是字符串时的表现，且 dist 是 ReproducibleBatchSampler
      应该返回新的 dataloader，并将 batch_sampler 替换为 dist 对应的 Sampler
      """
      dataloader = DataLoader(
          self.dataset, batch_size=2, shuffle=not shuffle
      )
      dist = ReproduceBatchSampler(
          BatchSampler(self.dataset, batch_size=4, shuffle=shuffle),
          4,
          False,
      )
      replaced_loader = self.driver.set_dist_repro_dataloader(
          dataloader, dist=dist, reproducible=False
      )
  
      assert not (replaced_loader is dataloader)
      assert isinstance(
          replaced_loader.batch_sampler, ReproduceBatchSampler
      )
      assert replaced_loader.batch_sampler is dist
  
      self.check_set_dist_repro_dataloader(
          dataloader, replaced_loader, shuffle
      )
  
imports: import pytest
  from pathlib import Path
  from fastNLP.core.drivers.paddle_driver.single_device import PaddleSingleDriver
  from fastNLP.core.samplers import ReproduceBatchSampler, RandomSampler
  from tests.helpers.models.paddle_model import PaddleNormalModel_Classification_1
  from tests.helpers.datasets.paddle_data import PaddleNormalDataset, PaddleNormalXYDataset
  from tests.helpers.datasets.torch_data import TorchNormalDataset
  from tests.helpers.models.torch_model import TorchNormalModel_Classification_1
  from fastNLP.envs.distributed import rank_zero_rm
  from fastNLP.envs.imports import _NEED_IMPORT_PADDLE, _NEED_IMPORT_TORCH
  from fastNLP import prepare_paddle_dataloader, BucketedBatchSampler
label_desc: Use image node_id 4 for calling the TestSetDistReproDataloader obj's underlying member method code with example usage: obj.test_with_dist_batch_sampler(shuffle) without return types