示例#1
0
def test_normal_search_space_set_low_high():
    search_space = {"mu": 0.5, "sigma": 1, "step": 0.1}

    search_space = validate_normal(search_space)

    assert "low" in search_space.keys()
    assert search_space["low"] == -np.inf
    assert "high" in search_space.keys()
    assert search_space["high"] == np.inf
示例#2
0
def test_normal_search_space_ok():
    search_space = {
        "mu": 0.5,
        "sigma": 1,
        "low": -5,
        "high": 5,
        "step": 0.1,
    }

    search_space = validate_normal(search_space)
示例#3
0
def test_normal_search_space_no_sigma():
    search_space = {
        "mu": 0.5,
        "low": -5,
        "high": 5,
        "step": 0.1,
    }

    with pytest.raises(ValidationError):
        search_space = validate_normal(search_space)
示例#4
0
def test_normal_search_space_bad_low():
    search_space = {
        "mu": 0.5,
        "sigma": 1,
        "low": [-5],
        "high": 5,
        "step": 0.1,
    }

    with pytest.raises(ValidationError):
        search_space = validate_normal(search_space)
示例#5
0
def test_normal_search_space_set_step():
    search_space = {
        "mu": 0.5,
        "sigma": 1,
        "low": -5,
        "high": 5,
    }

    search_space = validate_normal(search_space)
    assert "step" in search_space.keys()
    assert search_space["step"] is None
示例#6
0
def test_normal_search_space_not_dict():
    search_space = [0.5, 1],

    with pytest.raises(ValidationError):
        search_space = validate_normal(search_space)