Tests that insert_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)
| 13 | |
| 14 | |
| 15 | def test_insert_cost_zero_when_not_allowed(ok_small): |
| 16 | """ |
| 17 | Tests that insert_cost() returns zero when a move is not possible. This is |
| 18 | the only case where it shortcuts to return a non-negative delta cost. |
| 19 | """ |
| 20 | cost_eval = CostEvaluator([1], 1, 0) |
| 21 | route = make_search_route(ok_small, [1, 2]) |
| 22 | |
| 23 | # Inserting the depot is not possible. |
| 24 | assert_equal(insert_cost(route[0], route[1], ok_small, cost_eval), 0) |
| 25 | assert_equal(insert_cost(route[3], route[2], ok_small, cost_eval), 0) |
| 26 | |
| 27 | # Inserting after a node that's not in a route is not possible. |
| 28 | assert_equal(insert_cost(route[1], Node(loc=3), ok_small, cost_eval), 0) |
| 29 | |
| 30 | |
| 31 | def test_insert_cost(ok_small): |
nothing calls this directly
no test coverage detected