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

Function test_eq

tests/test_Trip.py:95–114  ·  view source on GitHub ↗

Tests the trip's equality operator.

(ok_small_multi_depot)

Source from the content-addressed store, hash-verified

93
94
95def test_eq(ok_small_multi_depot):
96 """
97 Tests the trip's equality operator.
98 """
99 trip1 = Trip(ok_small_multi_depot, [2, 3], 0, 0, 0)
100 trip2 = Trip(ok_small_multi_depot, [4], 0, 0, 0)
101 trip3 = Trip(ok_small_multi_depot, [2, 3], 0, 0, 0)
102
103 assert_(trip1 == trip1) # same object
104 assert_(trip1 != trip2) # different visits
105 assert_(trip1 == trip3) # same visits and start/end depots
106
107 trip4 = Trip(ok_small_multi_depot, [2, 3], 1, 1, 1)
108 assert_(trip1 != trip4) # different vehicle type, start/end depots
109
110 # And a few tests against things that are not trips, just to be sure that
111 # there's also a type check in there somewhere.
112 assert_(trip1 != 1)
113 assert_(trip2 != "abc")
114 assert_(trip3 != 5)
115
116
117def test_trip_iter_and_getitem(ok_small):

Callers

nothing calls this directly

Calls 1

TripClass · 0.90

Tested by

no test coverage detected