class_docstr: Targeted at testing functions of built-in tuners, including
      - [ ] load_checkpoint
      - [ ] save_checkpoint
      - [X] update_search_space
      - [X] generate_multiple_parameters
      - [X] import_data
      - [ ] trial_end
      - [x] receive_trial_result
class_docstr_tok: ["Targeted","at","testing","functions","of","built-in","tuners",",","including","-","[","]","load_checkpoint","-","[","]","save_checkpoint","-","[","X","]","update_search_space","-","[","X","]","generate_multiple_parameters","-","[","X","]","import_data","-","[","]","trial_end","-","[","x","]","receive_trial_result"]
docstr: import data at the beginning with number value and dict value
  import data in the middle also with number value and dict value, and duplicate data record
  generate parameters after data import
  
  Parameters
  ----------
  tuner_factory : lambda
      a lambda for instantiate a tuner
  stype : str
      the value type of hp choice, support "choice_str" and "choice_num"
docstr_tok: ["import","data","at","the","beginning","with","number","value","and","dict","value","import","data","in","the","middle","also","with","number","value","and","dict","value",",","and","duplicate","data","record","generate","parameters","after","data","import","Parameters","--","--","--","--","--","tuner_factory",":","lambda","a","lambda","for","instantiate","a","tuner","stype",":","str","the","value","type","of","hp","choice",",","support","``","choice_str","''","and","``","choice_num","''"]
code: def import_data_test(
      self, tuner_factory, stype="choice_str", support_middle=True
  ):
      """
      import data at the beginning with number value and dict value
      import data in the middle also with number value and dict value, and duplicate data record
      generate parameters after data import
  
      Parameters
      ----------
      tuner_factory : lambda
          a lambda for instantiate a tuner
      stype : str
          the value type of hp choice, support "choice_str" and "choice_num"
      """
      if stype == "choice_str":
          search_space = {
              "choice_str": {
                  "_type": "choice",
                  "_value": [
                      "cat",
                      "dog",
                      "elephant",
                      "cow",
                      "sheep",
                      "panda",
                      "tiger",
                  ],
              }
          }
      elif stype == "choice_num":
          search_space = {
              "choice_num": {
                  "_type": "choice",
                  "_value": [10, 20, 30, 40, 50, 60],
              }
          }
      else:
          raise RuntimeError("Unexpected stype")
      tuner = tuner_factory()
      self.assertIsInstance(tuner, Tuner)
      tuner.update_search_space(search_space)
      # import data at the beginning
      if stype == "choice_str":
          data = [
              {"parameter": {"choice_str": "cat"}, "value": 1.1},
              {
                  "parameter": {"choice_str": "dog"},
                  "value": {"default": 1.2, "tmp": 2},
              },
          ]
      else:
          data = [
              {"parameter": {"choice_num": 20}, "value": 1.1},
              {
                  "parameter": {"choice_num": 60},
                  "value": {"default": 1.2, "tmp": 2},
              },
          ]
      tuner.import_data(data)
      logger.info("Imported data successfully at the beginning")
      # generate parameters
      parameters = tuner.generate_multiple_parameters(list(range(3)))
      for i in range(3):
          tuner.receive_trial_result(
              i, parameters[i], random.uniform(-100, 100)
          )
      if not support_middle:
          return
      # import data in the middle
      if stype == "choice_str":
          data = [
              {"parameter": {"choice_str": "cat"}, "value": 1.1},
              {
                  "parameter": {"choice_str": "dog"},
                  "value": {"default": 1.2, "tmp": 2},
              },
              {"parameter": {"choice_str": "cow"}, "value": 1.3},
          ]
      else:
          data = [
              {"parameter": {"choice_num": 20}, "value": 1.1},
              {
                  "parameter": {"choice_num": 60},
                  "value": {"default": 1.2, "tmp": 2},
              },
              {"parameter": {"choice_num": 50}, "value": 1.3},
          ]
      tuner.import_data(data)
      logger.info("Imported data successfully in the middle")
      # generate parameters again
      parameters = tuner.generate_multiple_parameters([3])
      tuner.receive_trial_result(
          3, parameters[0], random.uniform(-100, 100)
      )
  
imports: import glob
  import json
  import logging
  import os
  import random
  import shutil
  import sys
  from collections import deque
  from unittest import TestCase, main
  from nni.algorithms.hpo.batch_tuner import BatchTuner
  from nni.algorithms.hpo.dngo_tuner import DNGOTuner
  from nni.algorithms.hpo.evolution_tuner import EvolutionTuner
  from nni.algorithms.hpo.gp_tuner import GPTuner
  from nni.algorithms.hpo.gridsearch_tuner import GridSearchTuner
  from nni.algorithms.hpo.hyperopt_tuner import HyperoptTuner
  from nni.algorithms.hpo.metis_tuner import MetisTuner
  from nni.algorithms.hpo.pbt_tuner import PBTTuner
  from nni.algorithms.hpo.random_tuner import RandomTuner
  from nni.algorithms.hpo.regularized_evolution_tuner import RegularizedEvolutionTuner
  from nni.algorithms.hpo.tpe_tuner import TpeTuner
  from nni.runtime.msg_dispatcher import _pack_parameter, MsgDispatcher
  from nni.tuner import Tuner
label_desc: Use image node_id 10 for calling the BuiltinTunersTestCase obj's underlying member method code with example usage: obj.import_data_test(tuner_factory, stype, support_middle) without return types