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

Function test_model_data

tests/test_Model.py:21–38  ·  view source on GitHub ↗

Tests that calling the ``data()`` member on the model returns a data instance representing the added data.

()

Source from the content-addressed store, hash-verified

19
20
21def test_model_data():
22 """
23 Tests that calling the ``data()`` member on the model returns a data
24 instance representing the added data.
25 """
26 model = Model()
27
28 # Let's add some data: a single client, and edges from/to the depot.
29 depot = model.add_depot(0, 0)
30 client = model.add_client(0, 1, delivery=1)
31 model.add_edge(depot, client, 1, 1)
32 model.add_edge(client, depot, 1, 1)
33 model.add_vehicle_type(capacity=1, num_available=1)
34
35 data = model.data()
36 assert_equal(data.num_clients, 1)
37 assert_equal(data.num_vehicle_types, 1)
38 assert_equal(data.num_vehicles, 1)
39
40
41def test_add_edge_raises_negative_distance_or_duration():

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected