def test_position2value_0(test_input, expected):
    search_space = {
        "x1": np.arange(-10, 11, 1),
    }

    conv = Converter(search_space)
    value = conv.position2value(test_input)

    assert value == expected
def test_value2position_0(test_input, expected):
    search_space = {
        "x1": np.arange(-10, 11, 1),
    }

    conv = Converter(search_space)
    position = conv.value2position(test_input)

    assert position == expected
def test_value2para_0(test_input, expected):
    search_space = {
        "x1": np.arange(-10, 11, 1),
    }

    conv = Converter(search_space)
    para = conv.value2para(test_input)

    assert para == expected
def test_dataframe2memory_dict_0(test_input, expected):
    search_space = {
        "x1": np.arange(-10, 11, 1),
        "x2": np.arange(0, 11, 1),
    }

    conv = Converter(search_space)
    order = ["x1", "x2"]
    conv = unordered_dict_workaround(conv, order)
    memory_dict = conv.dataframe2memory_dict(test_input)

    assert memory_dict == expected
def test_positions2values_1(test_input, expected):
    search_space = {
        "x1": np.arange(-10, 11, 1),
        "x2": np.arange(0, 11, 1),
    }

    conv = Converter(search_space)
    order = ["x1", "x2"]
    conv = unordered_dict_workaround(conv, order)
    values = conv.positions2values(test_input)

    assert equal_arraysInList(values, expected)
def test_para2value_1(test_input, expected):
    search_space = {
        "x1": np.arange(-10, 11, 1),
        "x2": np.arange(0, 11, 1),
    }

    conv = Converter(search_space)
    order = ["x1", "x2"]
    conv = unordered_dict_workaround(conv, order)
    value = conv.para2value(test_input)

    assert (value == expected).all()
def test_value2para_1(test_input, expected):
    search_space = {
        "x1": np.arange(-10, 11, 1),
        "x2": np.arange(0, 11, 1),
    }

    conv = Converter(search_space)
    order = ["x1", "x2"]
    conv = unordered_dict_workaround(conv, order)
    para = conv.value2para(test_input)

    assert para == expected
def test_memory_dict2positions_scores_0(test_input, expected):
    search_space = {
        "x1": np.arange(-10, 11, 1),
        "x2": np.arange(0, 11, 1),
    }

    conv = Converter(search_space)
    order = ["x1", "x2"]
    conv = unordered_dict_workaround(conv, order)
    positions, scores = conv.memory_dict2positions_scores(test_input)

    idx_order = get_idx_order(scores, expected[1])
    scores_reordered = reorder(scores, idx_order)
    positions_reordered = reorder(positions, idx_order)

    assert equal_arraysInList(positions_reordered, expected[0])
    assert scores_reordered == expected[1]
def test_memory_dict2dataframe_0(test_input, expected):
    search_space = {
        "x1": np.arange(-10, 11, 1),
        "x2": np.arange(0, 11, 1),
    }

    conv = Converter(search_space)
    order = ["x1", "x2"]
    conv = unordered_dict_workaround(conv, order)
    dataframe = conv.memory_dict2dataframe(test_input)

    dataframe.sort_values("score", inplace=True)
    expected.sort_values("score", inplace=True)

    dataframe.reset_index(drop=True, inplace=True)
    expected.reset_index(drop=True, inplace=True)

    dataframe = dataframe[expected.columns]

    assert dataframe.equals(expected)