示例#1
0
def all_funcs_agraph():
    test_graph = agraph.AGraph()
    return _set_all_funcs_agraph_data(test_graph)
示例#2
0
def invalid_agraph(sample_agraph_1):
    test_graph = agraph.AGraph()
    test_graph.command_array = sample_agraph_1.command_array
    return test_graph
示例#3
0
def test_setting_fitness_updates_fit_set():
    sample_agraph = agraph.AGraph()
    assert not sample_agraph.fit_set
    sample_agraph.fitness = 0
    assert sample_agraph.fit_set
示例#4
0
    assert not invalid_agraph_list.needs_local_optimization()
    np.testing.assert_allclose(
        invalid_agraph_list.evaluate_equation_at(sample_agraph_1_values.x),
        sample_agraph_1_list.evaluate_equation_at(sample_agraph_1_values.x))


def test_setting_fitness_updates_fit_set():
    sample_agraph = agraph.AGraph()
    assert not sample_agraph.fit_set
    sample_agraph.fitness = 0
    assert sample_agraph.fit_set


@pytest.mark.parametrize(
    'agraph',
    (agraph.AGraph(),
     pytest.param(cpp_agraph,
                  marks=pytest.mark.skipif(not bingocpp,
                                           reason='BingoCpp import failure'))))
def test_setting_fitness_updates_fit_set_cpp(agraph):
    sample_agraph = agraph
    assert not sample_agraph.fit_set
    sample_agraph.fitness = 0
    assert sample_agraph.fit_set


def test_notify_command_array_modification(sample_agraph_1_list):
    assert sample_agraph_1_list.fit_set
    sample_agraph_1_list.notify_command_array_modification()
    assert not sample_agraph_1_list.fit_set