Tests that the shift duration attribute of vehicle types is reflected in the route's time warp calculations.
(ok_small, shift_duration: int, expected: int)
| 544 | ], |
| 545 | ) |
| 546 | def test_shift_duration(ok_small, shift_duration: int, expected: int): |
| 547 | """ |
| 548 | Tests that the shift duration attribute of vehicle types is reflected |
| 549 | in the route's time warp calculations. |
| 550 | """ |
| 551 | vehicle_type = VehicleType(3, capacity=[10], shift_duration=shift_duration) |
| 552 | data = ok_small.replace(vehicle_types=[vehicle_type]) |
| 553 | |
| 554 | route = Route(data, 0, 0) |
| 555 | for client in range(data.num_depots, data.num_locations): |
| 556 | route.append(Node(loc=client)) |
| 557 | |
| 558 | route.update() |
| 559 | assert_equal(route.duration(), 7_950) |
| 560 | assert_(route.has_time_warp()) |
| 561 | assert_equal(route.time_warp(), expected) |
| 562 | |
| 563 | |
| 564 | @pytest.mark.parametrize( |