Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 1e78a88

Browse files
authored
Merge pull request #406 from BlueBrain/fix_test_CMA
Fix tests CMA
2 parents dd5713d + 7fa4c94 commit 1e78a88

File tree

5 files changed

+188
-774
lines changed

5 files changed

+188
-774
lines changed

bluepyopt/tests/test_deapext/test_optimisationsCMA.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def test_optimisationsCMA_normspace():
1919
optimisation.to_space)]
2020

2121
for a, b in zip(x, y):
22-
assert abs(a - b) < 1e-5
22+
assert b == pytest.approx(a, abs=1e-5)
2323

2424

2525
@pytest.mark.unit
@@ -34,9 +34,10 @@ def test_optimisationsCMA_SO_run():
3434
optimisation = optimiser(evaluator=evaluator, centroids=[x])
3535
pop, hof, log, hist = optimisation.run(max_ngen=2)
3636

37-
assert abs(log.select("avg")[-1] - 53.3333) < 1e-4
38-
assert abs(log.select("std")[-1] - 83.7987) < 1e-4
39-
assert pop[0] == [0.10525059698894745, 0.01000000003249999]
37+
assert log.select("avg")[-1] == pytest.approx(53.3333, abs=1e-4)
38+
assert log.select("std")[-1] == pytest.approx(83.7987, abs=1e-4)
39+
assert pop[0][0] == pytest.approx(0.10525059698894745, abs=1e-6)
40+
assert pop[0][1] == pytest.approx(0.01000000003249999, abs=1e-6)
4041

4142

4243
@pytest.mark.unit
@@ -55,6 +56,7 @@ def test_optimisationsCMA_MO_run():
5556
)
5657
pop, hof, log, hist = optimisation.run(max_ngen=2)
5758

58-
assert abs(log.select("avg")[-1] - 40.) < 1e-4
59-
assert abs(log.select("std")[-1] - 16.32993) < 1e-4
60-
assert pop[0] == [0.09601241274168831, 0.024646650865379722]
59+
assert log.select("avg")[-1] == pytest.approx(40., abs=1e-4)
60+
assert log.select("std")[-1] == pytest.approx(16.32993, abs=1e-4)
61+
assert pop[0][0] == pytest.approx(0.09601241274168831, abs=1e-6)
62+
assert pop[0][1] == pytest.approx(0.024646650865379722, abs=1e-6)

examples/l5pc/mechanisms/ProbAMPANMDA_EMS.mod

Lines changed: 0 additions & 329 deletions
This file was deleted.

0 commit comments

Comments
 (0)