def test_with_planned_trip(self): stop = jit.Stop(self.vehicle, self.position, self.stops[0]) delivery_planned_trip = generate_one_planned_trip( feasible=True, vehicle=self.vehicle, pickup_stop=self.stops[0], delivery_stop=stop, ) pickup_planned_trip = generate_one_planned_trip( feasible=True, vehicle=self.vehicle, pickup_stop=stop, ) self.assertIn(delivery_planned_trip, stop.delivery_planned_trips) self.assertNotIn(delivery_planned_trip, stop.pickup_planned_trips) self.assertNotIn(pickup_planned_trip, stop.delivery_planned_trips) self.assertIn(pickup_planned_trip, stop.pickup_planned_trips) self.assertIsInstance(stop.identifier, str) iterable = it.chain( (f'P{planned_trip.trip_identifier}' for planned_trip in stop.pickup_planned_trips), (f'D{planned_trip.trip_identifier}' for planned_trip in stop.delivery_planned_trips), ) identifier = '|'.join(iterable) identifier = f'[{identifier}]' self.assertEqual(identifier, stop.identifier)
def test_creation(self): planned_trip = generate_one_planned_trip(False) exc = jit.NonFeasiblePlannedTripException(planned_trip) self.assertIsInstance(exc, jit.JineteException) self.assertEqual(exc.planned_trip, planned_trip) self.assertEqual(exc.message, f'Planned Trip "{planned_trip}" is not feasible.')
def test_feasible_planned_trip(self): planned_trip = generate_one_planned_trip(True) self.assertTrue(planned_trip.feasible)
def test_not_feasible_planned_trip(self): planned_trip = generate_one_planned_trip(False) self.assertFalse(planned_trip.feasible)