MCPcopy Index your code
hub / github.com/PyVRP/PyVRP / test_replacing_client_groups

Function test_replacing_client_groups

tests/test_ProblemData.py:952–968  ·  view source on GitHub ↗

Tests that replacing mutually exclusive client groups works well.

(ok_small)

Source from the content-addressed store, hash-verified

950
951
952def test_replacing_client_groups(ok_small):
953 """
954 Tests that replacing mutually exclusive client groups works well.
955 """
956 assert_equal(ok_small.num_groups, 0)
957 assert_equal(ok_small.groups(), [])
958
959 # Let's add the first client to a group, and define a new data instance
960 # that has a mutually exclusive group.
961 clients = ok_small.clients()
962 clients[0] = Client(1, 1, delivery=[1], required=False, group=0)
963 data = ok_small.replace(clients=clients, groups=[ClientGroup([1])])
964
965 # There should now be a single client group (at index 0) that has the first
966 # client as its only member.
967 assert_equal(data.num_groups, 1)
968 assert_equal(data.group(0).clients, [1])
969
970
971def test_client_eq():

Callers

nothing calls this directly

Calls 5

ClientClass · 0.90
ClientGroupClass · 0.90
groupsMethod · 0.80
clientsMethod · 0.80
replaceMethod · 0.80

Tested by

no test coverage detected