Skip to content

Commit 84aeee8

Browse files
committed
test: enable test for plotting code
1 parent 6bf3ac2 commit 84aeee8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

tests/test_monitors.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ def test_eval_monitor_with_so(full_fit_history, full_sol_history, topk):
4848
assert (monitor.get_best_solution(state)[0] == pop2[-1]).all()
4949
assert (monitor.get_topk_solutions(state)[0] == pop2[-topk:][::-1]).all()
5050

51+
if full_fit_history:
52+
monitor.plot(state)
53+
5154

5255
@pytest.mark.parametrize(
5356
"full_fit_history,full_sol_history",
@@ -83,6 +86,9 @@ def test_eval_monitor_with_mo(full_fit_history, full_sol_history):
8386
assert (monitor.get_latest_fitness(state)[0] == fitness2).all()
8487
assert (monitor.get_latest_solution(state)[0] == pop2).all()
8588

89+
if full_fit_history:
90+
monitor.plot(state)
91+
8692

8793
@pytest.mark.parametrize(
8894
"full_fit_history,full_pop_history",
@@ -104,9 +110,13 @@ def test_pop_monitor(full_fit_history, full_pop_history):
104110
state = workflow.init(key)
105111
state = workflow.step(state)
106112
assert (
107-
use_state(monitor.get_latest_fitness)(state)[0] == state.get_child_state("algorithm").fitness
113+
use_state(monitor.get_latest_fitness)(state)[0]
114+
== state.get_child_state("algorithm").fitness
108115
).all()
109116
assert (
110117
use_state(monitor.get_latest_population)(state)[0]
111118
== state.get_child_state("algorithm").population
112119
).all()
120+
121+
if full_fit_history:
122+
monitor.plot(state)

0 commit comments

Comments
 (0)