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

Function test_route_append_increases_route_len

tests/search/test_Route.py:98–113  ·  view source on GitHub ↗

Tests that appending nodes to a route increases the route's length.

(ok_small)

Source from the content-addressed store, hash-verified

96
97
98def test_route_append_increases_route_len(ok_small):
99 """
100 Tests that appending nodes to a route increases the route's length.
101 """
102 route = Route(ok_small, idx=0, vehicle_type=0)
103 assert_equal(route.num_clients(), 0)
104
105 node = Node(loc=1)
106 route.append(node)
107 assert_equal(route.num_clients(), 1)
108 assert_(route[1] is node) # pointers, so must be same object
109
110 node = Node(loc=2)
111 route.append(node)
112 assert_equal(route.num_clients(), 2)
113 assert_(route[2] is node) # pointers, so must be same object
114
115
116def test_route_insert(ok_small):

Callers

nothing calls this directly

Calls 4

NodeClass · 0.85
num_clientsMethod · 0.80
appendMethod · 0.80
RouteClass · 0.50

Tested by

no test coverage detected