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

Function test_bug_client_group_indices

tests/test_Model.py:977–997  ·  view source on GitHub ↗

Tests the bug of #681. Because empty client groups compare equal, the group to index implementation returned the first object that compared equal, in this case resulting in both clients being inserted into the first client group rather than the each into one.

()

Source from the content-addressed store, hash-verified

975
976
977def test_bug_client_group_indices():
978 """
979 Tests the bug of #681. Because empty client groups compare equal, the
980 group to index implementation returned the first object that compared
981 equal, in this case resulting in both clients being inserted into the
982 first client group rather than the each into one.
983 """
984 m = Model()
985 m.add_depot(x=0, y=0)
986
987 group1 = m.add_client_group()
988 group2 = m.add_client_group()
989
990 client1 = m.add_client(x=0, y=0, required=False, group=group2)
991 assert_equal(client1.group, 1)
992
993 client2 = m.add_client(x=0, y=0, required=False, group=group1)
994 assert_equal(client2.group, 0)
995
996 assert_equal(len(group1), 1)
997 assert_equal(len(group2), 1)
998
999
1000def test_integer_vehicle_capacity_and_load_arguments_are_promoted_to_lists():

Callers

nothing calls this directly

Calls 4

add_depotMethod · 0.95
add_client_groupMethod · 0.95
add_clientMethod · 0.95
ModelClass · 0.90

Tested by

no test coverage detected