This commit is contained in:
Raul Marin 2019-10-07 18:09:37 +02:00
parent f1bfc70e6e
commit 5ab5e8ddf9

View File

@ -27,7 +27,7 @@ WELL_KNOWN_SHAPE = [(40.73312, -73.98891), (40.73353, -73.98987),
(40.73219, -73.99856), (40.73222, -73.99861),
(40.73225, -73.99868), (40.73293, -74.00007),
(40.733, -74.00001)]
WELL_KNOWN_LENGTH = 1317.9
WELL_KNOWN_LENGTH = 1384.9
class MapboxRoutingTestCase(unittest.TestCase):
@ -59,6 +59,8 @@ class MapboxRoutingTestCase(unittest.TestCase):
def test_valid_request(self):
route = self.routing.directions(VALID_WAYPOINTS, VALID_PROFILE)
self.assertEqual(route.shape, WELL_KNOWN_SHAPE)
self.assertEqual(route.length, WELL_KNOWN_LENGTH)
assert route.shape # The duration may change with time
# Since the distance varies with the route, accept a margin
self.assertGreater(route.length, WELL_KNOWN_LENGTH * 0.9)
self.assertLess(route.length, WELL_KNOWN_LENGTH * 1.1)
assert route.duration # The duration may change between executions