code: def _add_test(param_setting, methodname):
      """
      Adds a Test to TestData according to settings
  
      Args:
          param_setting: list of tuples of (param, setting)
          methodname: name of the method that gets called
      """
  
      def test_method(self):
          if param_setting:
              opt = copy.deepcopy(self.opt)
              for param, setting in param_setting:
                  setattr(opt, param, setting)
          else:
              opt = self.opt
          getattr(self, methodname)(opt)
  
      if param_setting:
          name = (
              "test_"
              + methodname
              + "_"
              + "_".join(str(param_setting).split())
          )
      else:
          name = "test_" + methodname + "_standard"
      setattr(TestData, name, test_method)
      test_method.__name__ = name
  
file_path: OpenNMT-py/onmt/tests/test_data_prepare.py
imports: import copy
  import unittest
  import glob
  import os
  from onmt.utils.parse import ArgumentParser
  from onmt.opts import data_prepare_opts
  from onmt.train_single import prepare_transforms_vocabs
  from onmt.constants import CorpusName
label_desc: Use image node_id 2 for calling a global function with example usage: _add_test(param_setting, methodname) without return types