code: def test_new_hp(tmp_path):
      class MyGridSearch(gridsearch.GridSearch):
          def run_trial(self, trial, *args, **kwargs):
              hp = trial.hyperparameters
              if hp.Boolean("bool"):
                  hp.Choice("choice1", [0, 1, 2])
              else:
                  hp.Choice("choice2", [3, 4, 5])
              return random.random()
  
      tuner = MyGridSearch(directory=tmp_path)
      tuner.search(verbose=0)
      assert len(tuner.oracle.trials) == 3 + 3 * 3
  
file_path: keras-tuner/keras_tuner/tuners/gridsearch_test.py
imports: import random
  from keras_tuner.backend import keras
  from keras_tuner.engine import hypermodel
  from keras_tuner.engine import trial
  from keras_tuner.tuners import gridsearch
label_desc: Use image node_id 3 for calling a global function with example usage: test_new_hp(tmp_path) and returns: random