Tests that disabling printing works.
(ok_small, caplog)
| 105 | |
| 106 | |
| 107 | def test_should_print_false_no_output(ok_small, caplog): |
| 108 | """ |
| 109 | Tests that disabling printing works. |
| 110 | """ |
| 111 | sol = Solution(ok_small, [[1, 2, 3, 4]]) |
| 112 | cost_eval = CostEvaluator([20], 6, 6) |
| 113 | |
| 114 | stats = Statistics() |
| 115 | stats.collect(sol, sol, sol, cost_eval) |
| 116 | |
| 117 | # Set up the progress printer, call all its methods, and then check that |
| 118 | # the output captured on stdout is empty. |
| 119 | printer = ProgressPrinter(should_print=False, display_interval=0.0) |
| 120 | printer.start(ok_small) |
| 121 | printer.iteration(stats=stats) |
| 122 | printer.restart() |
| 123 | |
| 124 | rng = RandomNumberGenerator(42) |
| 125 | sol = Solution.make_random(ok_small, rng) |
| 126 | printer.end(result=Result(sol, stats, 25, 0.05)) |
| 127 | |
| 128 | assert_equal(caplog.text, "") |
nothing calls this directly
no test coverage detected