Tests that remove_cost() returns zero when a move is not possible. This is the only case where it shortcuts to return a non-negative delta cost.
(ok_small)
| 88 | |
| 89 | |
| 90 | def test_remove_cost_zero_when_not_allowed(ok_small): |
| 91 | """ |
| 92 | Tests that remove_cost() returns zero when a move is not possible. This is |
| 93 | the only case where it shortcuts to return a non-negative delta cost. |
| 94 | """ |
| 95 | cost_eval = CostEvaluator([1], 1, 0) |
| 96 | route = make_search_route(ok_small, [1, 2]) |
| 97 | |
| 98 | # Removing the depot is not possible. |
| 99 | assert_equal(remove_cost(route[0], ok_small, cost_eval), 0) |
| 100 | assert_equal(remove_cost(route[3], ok_small, cost_eval), 0) |
| 101 | |
| 102 | # Removing a node that's not in a route is not possible. |
| 103 | assert_equal(remove_cost(Node(loc=3), ok_small, cost_eval), 0) |
| 104 | |
| 105 | |
| 106 | def test_remove(ok_small): |
nothing calls this directly
no test coverage detected