コード例 #1
0
def test_rs_initialize2():

    sp = Searchspace(argument_param=("DISCRETE", [1, 5]))

    rs = RandomSearch()
    rs.searchspace = sp

    with pytest.raises(NotImplementedError) as excinfo:
        rs.initialize()
    assert "Searchspace needs at least one continuous parameter" in str(
        excinfo.value)
コード例 #2
0
def test_random_search(sc):

    sp = Searchspace(argument_param=("DOUBLE", [1, 5]))

    rs = RandomSearch()
    rs.searchspace = sp

    rs.num_trials = 5
    exp_result = {"argument_param": "DOUBLE"}

    assert sp.names() == exp_result
    assert rs.num_trials == 5
    assert rs.searchspace == sp