code: def test_group_multi_source_sampler(self):
      sampler = GroupMultiSourceSampler(
          self.dataset, batch_size=5, source_ratio=[1, 4]
      )
      sampler = iter(sampler)
      flags = []
      groups = []
      for i in range(100):
          idx = next(sampler)
          data_info = self.dataset.get_data_info(idx)
          flags.append(data_info["flag"])
          group = 0 if data_info["width"] < data_info["height"] else 1
          groups.append(group)
      flags_gt = ["a", "b", "b", "b", "b"] * 20
      self.assertEqual(flags, flags_gt)
      groups = set(
          [
              sum(x)
              for x in (groups[k : k + 5] for k in range(0, 100, 5))
          ]
      )
      groups_gt = set([0, 5])
      self.assertEqual(groups, groups_gt)
  
imports: import bisect
  from unittest import TestCase
  from unittest.mock import patch
  import numpy
  from torch.utils.data import ConcatDataset, Dataset
  from mmdet.datasets.samplers import GroupMultiSourceSampler, MultiSourceSampler
label_desc: Use image node_id 2 for calling the TestGroupMultiSourceSampler obj's underlying member method code with example usage: obj.test_group_multi_source_sampler() without return types