code: def test_balanced_bigger_batches():
      sampler = BalancedBatchSampler(MyDataset(), batch_size=12 * 4)
      assert len(sampler) == 1
      batches = list(itertools.islice(sampler, 3))
      assert len(batches) == 1
      batch = batches[0]
      assert len(batch) == 48
      counts = Counter(map(idx_to_class, batch))
      assert counts == {"1": 12, "2": 12, "3": 12, "4": 12}
  
      # 2 duplicates for class 1, 2, 4
      counts = Counter(batch)
      assert sorted(
          idx_to_class(idx) for idx, nb in counts.items() if nb > 1
      ) == ["1", "1", "2", "2", "4", "4"]
  
file_path: pykale/tests/loaddata/test_sampler.py
imports: import itertools
  from collections import Counter
  import numpy
  from kale.loaddata.sampler import BalancedBatchSampler, ReweightedBatchSampler
label_desc: Use image node_id 3 for calling a global function with example usage: test_balanced_bigger_batches() without return types