Tests that the progress printer outputs some summary statistics about the best-found solution and solver run when calling end.
(ok_small, caplog)
| 44 | |
| 45 | |
| 46 | def test_end(ok_small, caplog): |
| 47 | """ |
| 48 | Tests that the progress printer outputs some summary statistics about the |
| 49 | best-found solution and solver run when calling end. |
| 50 | """ |
| 51 | best = Solution(ok_small, [[1, 2], [3, 4]]) |
| 52 | res = Result(best, Statistics(), 25, 0.05) |
| 53 | |
| 54 | printer = ProgressPrinter(should_print=True, display_interval=1.0) |
| 55 | printer.end(res) |
| 56 | |
| 57 | out = caplog.text |
| 58 | assert_(str(round(res.cost())) in out) |
| 59 | assert_(str(res.num_iterations) in out) |
| 60 | assert_(str(round(res.runtime)) in out) |
| 61 | |
| 62 | for line in res.summary().splitlines(): |
| 63 | assert_(line in out) |
| 64 | |
| 65 | |
| 66 | def test_restart(caplog): |
nothing calls this directly
no test coverage detected