code: def _test_sample_helper(
      self,
      expected_sample_from_first_ds_percentage,
      num_samples=1000,
      sampling_func=None,
  ):
      # To make sure test is not flaky
      np.random.seed(0)
      if sampling_func is None:
          m = MultiCorpusSampledDataset(
              OrderedDict({0: self.dataset_1, 1: self.dataset_2}),
          )
      else:
          m = MultiCorpusSampledDataset(
              OrderedDict({0: self.dataset_1, 1: self.dataset_2}),
              sampling_func=sampling_func,
          )
      m.ordered_indices()
      count_sample_from_first_dataset = 0
      for _ in range(num_samples):
          if (
              m.collater([m[0], m[1]])["net_input"]["src_tokens"][0]
              == 1
          ):
              count_sample_from_first_dataset += 1
      sample_from_first_ds_percentage = (
          1.0 * count_sample_from_first_dataset / num_samples
      )
      self.assertLess(
          abs(
              sample_from_first_ds_percentage
              - expected_sample_from_first_ds_percentage
          ),
          0.01,
      )
  
file_path: fairseq/tests/test_multi_corpus_sampled_dataset.py
imports: import unittest
  from collections import OrderedDict
  import numpy
  import torch
  from fairseq.data import LanguagePairDataset, TokenBlockDataset
  from fairseq.data.multi_corpus_sampled_dataset import MultiCorpusSampledDataset
  from tests.test_train import mock_dict
label_desc: Use image node_id 2 for calling the TestMultiCorpusSampledDataset obj's underlying member method code with example usage: obj._test_sample_helper(expected_sample_from_first_ds_percentage, num_samples, sampling_func) without return types