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

Function test_to_data_client_group

tests/test_Model.py:706–725  ·  view source on GitHub ↗

Tests that creating a small model with a client group results in a correct ProblemData instance that has the appropriate group memberships set up.

()

Source from the content-addressed store, hash-verified

704
705
706def test_to_data_client_group():
707 """
708 Tests that creating a small model with a client group results in a correct
709 ProblemData instance that has the appropriate group memberships set up.
710 """
711 m = Model()
712 m.add_depot(1, 1)
713 m.add_vehicle_type()
714
715 group = m.add_client_group()
716 m.add_client(1, 1, required=False, group=group)
717 m.add_client(2, 2, required=False, group=group)
718
719 # Generate the data instance. There should be a single client group, and
720 # the first two clients should be members of that group.
721 data = m.data()
722 assert_equal(data.num_groups, 1)
723
724 group = data.group(0)
725 assert_equal(group.clients, [1, 2])
726
727
728def test_raises_mutually_exclusive_client_group_required_client():

Callers

nothing calls this directly

Calls 6

add_depotMethod · 0.95
add_vehicle_typeMethod · 0.95
add_client_groupMethod · 0.95
add_clientMethod · 0.95
dataMethod · 0.95
ModelClass · 0.90

Tested by

no test coverage detected