def test_hyperparameters_added(tmp_dir):
    hps = hp_module.HyperParameters()
    hps.Int('a', (- 100), 100)
    oracle = bo_module.BayesianOptimizationOracle(objective=kt.Objective('score', direction='max'), max_trials=20, hyperparameters=hps, num_initial_points=2)
    oracle._set_project_dir(tmp_dir, 'untitled')
    for i in range(10):
        trial = trial_module.Trial(hyperparameters=hps.copy())
        trial.hyperparameters.values['a'] = (10 * i)
        trial.score = i
        trial.status = 'COMPLETED'
        oracle.trials[trial.trial_id] = trial
    new_hps = hp_module.HyperParameters()
    new_hps.Float('b', 3.2, 6.4, step=0.2, default=3.6)
    new_hps.Boolean('c', default=True)
    oracle.update_space(new_hps)
    trial = oracle.create_trial('tuner0')
    assert (trial.status == 'RUNNING')
    assert ('b' in trial.hyperparameters.values)
    assert ('c' in trial.hyperparameters.values)
def test_hyperparameters_added(tmp_dir):
    hps = hp_module.HyperParameters()
    hps.Int('a', (- 100), 100)
    oracle = bo_module.BayesianOptimizationOracle(objective=kt.Objective('score', direction='max'), max_trials=20, hyperparameters=hps, num_initial_points=2)
    oracle._set_project_dir(tmp_dir, 'untitled')
    for i in range(10):
        trial = trial_module.Trial(hyperparameters=hps.copy())
        trial.hyperparameters.values['a'] = (10 * i)
        trial.score = i
        trial.status = 'COMPLETED'
        oracle.trials[trial.trial_id] = trial
    new_hps = hp_module.HyperParameters()
    new_hps.Float('b', 3.2, 6.4, step=0.2, default=3.6)
    new_hps.Boolean('c', default=True)
    oracle.update_space(new_hps)
    trial = oracle.create_trial('tuner0')
    assert (trial.status == 'RUNNING')
    assert ('b' in trial.hyperparameters.values)
    assert ('c' in trial.hyperparameters.values)