MCPcopy Create free account
hub / github.com/PyVRP/PyVRP / test_end

Function test_end

tests/test_ProgressPrinter.py:46–63  ·  view source on GitHub ↗

Tests that the progress printer outputs some summary statistics about the best-found solution and solver run when calling end.

(ok_small, caplog)

Source from the content-addressed store, hash-verified

44
45
46def 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
66def test_restart(caplog):

Callers

nothing calls this directly

Calls 7

endMethod · 0.95
costMethod · 0.95
summaryMethod · 0.95
SolutionClass · 0.90
ResultClass · 0.90
StatisticsClass · 0.90
ProgressPrinterClass · 0.90

Tested by

no test coverage detected