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

Function test_raises_invalid_client_group_indices

tests/test_ProblemData.py:848–864  ·  view source on GitHub ↗

Tests that setting the clients in a mutually exclusive group to values that are not valid indices raises, and that setting a group index on a client to a value that's out of range likewise raises.

(
    groups: list[ClientGroup], index: int
)

Source from the content-addressed store, hash-verified

846 ],
847)
848def test_raises_invalid_client_group_indices(
849 groups: list[ClientGroup], index: int
850):
851 """
852 Tests that setting the clients in a mutually exclusive group to values that
853 are not valid indices raises, and that setting a group index on a client to
854 a value that's out of range likewise raises.
855 """
856 with assert_raises(IndexError):
857 ProblemData(
858 clients=[Client(1, 1, required=False, group=index)],
859 depots=[Depot(1, 1)],
860 vehicle_types=[VehicleType()],
861 distance_matrices=[np.zeros((2, 2))],
862 duration_matrices=[np.zeros((2, 2))],
863 groups=groups,
864 )
865
866
867@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

ProblemDataClass · 0.90
ClientClass · 0.90
DepotClass · 0.90
VehicleTypeClass · 0.90

Tested by

no test coverage detected