commit
80ab38a0c9
@ -27,7 +27,7 @@ WELL_KNOWN_SHAPE = [(40.73312, -73.98891), (40.73353, -73.98987),
|
|||||||
(40.73219, -73.99856), (40.73222, -73.99861),
|
(40.73219, -73.99856), (40.73222, -73.99861),
|
||||||
(40.73225, -73.99868), (40.73293, -74.00007),
|
(40.73225, -73.99868), (40.73293, -74.00007),
|
||||||
(40.733, -74.00001)]
|
(40.733, -74.00001)]
|
||||||
WELL_KNOWN_LENGTH = 1317.9
|
WELL_KNOWN_LENGTH = 1384.9
|
||||||
|
|
||||||
|
|
||||||
class MapboxRoutingTestCase(unittest.TestCase):
|
class MapboxRoutingTestCase(unittest.TestCase):
|
||||||
@ -59,6 +59,8 @@ class MapboxRoutingTestCase(unittest.TestCase):
|
|||||||
def test_valid_request(self):
|
def test_valid_request(self):
|
||||||
route = self.routing.directions(VALID_WAYPOINTS, VALID_PROFILE)
|
route = self.routing.directions(VALID_WAYPOINTS, VALID_PROFILE)
|
||||||
|
|
||||||
self.assertEqual(route.shape, WELL_KNOWN_SHAPE)
|
assert route.shape # The duration may change with time
|
||||||
self.assertEqual(route.length, WELL_KNOWN_LENGTH)
|
# 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
|
assert route.duration # The duration may change between executions
|
||||||
|
Loading…
Reference in New Issue
Block a user