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

Function test_finalise_back_front_merge_same_thing

tests/test_DurationSegment.py:359–374  ·  view source on GitHub ↗

Tests that finalising either the front or the back and then merging on the appropriate side results in segments with the same duration and time warp attributes.

()

Source from the content-addressed store, hash-verified

357
358
359def test_finalise_back_front_merge_same_thing():
360 """
361 Tests that finalising either the front or the back and then merging on the
362 appropriate side results in segments with the same duration and time warp
363 attributes.
364 """
365 ds1 = DurationSegment(50, 0, 70, 110, 100)
366 ds2 = DurationSegment(45, 0, 30, 50, 50)
367
368 # Finalise the first segment at its back, then merge. Or finalise the
369 # second segment at the front and then merge. This should result in the
370 # same segment w.r.t. time warp and duration.
371 finalise_back = DurationSegment.merge(0, ds1.finalise_back(), ds2)
372 finalise_front = DurationSegment.merge(0, ds1, ds2.finalise_front())
373 assert_equal(finalise_back.time_warp(), finalise_front.time_warp())
374 assert_equal(finalise_back.duration(), finalise_front.duration())

Callers

nothing calls this directly

Calls 3

DurationSegmentClass · 0.85
mergeMethod · 0.45
durationMethod · 0.45

Tested by

no test coverage detected