Example #1
0
    def test_get_current_leg_bad_index(self):
        distance = Distance(10)
        time = Time(20)
        sdt = SpeedDistanceTime(distance=distance, time=time)
        latitude = Coordinate(56, 42, 10, "N")
        longitude = Coordinate(2, 5, 19, "W")
        waypoint = Waypoint(latitude, longitude)
        bearing = CompassBearing(190)
        leg = Leg(sdt, waypoint, bearing)
        legs = [leg]
        route = Route(legs)

        self.assertIsInstance(route, Route)
        with self.assertRaises(IndexError):
            route.current_leg(1)
Example #2
0
    def test_get_current_leg_of_route(self):
        distance = Distance(10)
        time = Time(20)
        sdt = SpeedDistanceTime(distance=distance, time=time)
        latitude = Coordinate(56, 42, 10, "N")
        longitude = Coordinate(2, 5, 19, "W")
        waypoint = Waypoint(latitude, longitude)
        bearing = CompassBearing(190)
        leg = Leg(sdt, waypoint, bearing)
        legs = [leg]
        route = Route(legs)

        self.assertIsInstance(route, Route)
        self.assertEqual(route.current_leg(0), leg)