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

Function test_from_data_client_group

tests/test_Model.py:679–703  ·  view source on GitHub ↗

Test that creating a model from a given data instance with client groups correctly sets up the client groups in the model.

(ok_small)

Source from the content-addressed store, hash-verified

677
678
679def test_from_data_client_group(ok_small):
680 """
681 Test that creating a model from a given data instance with client groups
682 correctly sets up the client groups in the model.
683 """
684 clients = ok_small.clients()
685 clients[0] = Client(1, 1, delivery=[1], required=False, group=0)
686 clients[1] = Client(1, 1, delivery=[1], required=False, group=0)
687
688 group = ClientGroup([1, 2])
689
690 data = ok_small.replace(clients=clients, groups=[group])
691 model = Model.from_data(data)
692
693 # Test that the clients have been correctly registered, and that there is
694 # a client group in the model.
695 assert_equal(model.clients[0].group, 0)
696 assert_equal(model.clients[1].group, 0)
697 assert_equal(len(model.groups), 1)
698
699 # Test that that group actually contains the clients.
700 group = model.groups[0]
701 assert_(group.required)
702 assert_equal(len(group), 2)
703 assert_equal(group.clients, [1, 2])
704
705
706def test_to_data_client_group():

Callers

nothing calls this directly

Calls 5

ClientClass · 0.90
ClientGroupClass · 0.90
clientsMethod · 0.80
replaceMethod · 0.80
from_dataMethod · 0.80

Tested by

no test coverage detected