Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Commit

Permalink
Merge branch 'matrix-v1' into deprecate-distance
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean C. Gillies committed Jan 6, 2018
2 parents b7378b2 + 9fb0497 commit a849083
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/matrix.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The input waypoints to the `directions` method are

```

The `distance` method can be called with a list of point features and the
The `matrix` method can be called with a list of point features and the
travel profile.

```python
Expand All @@ -81,4 +81,4 @@ zeros.

```

See ``import mapbox; help(mapbox.Distance)`` for more detailed usage.
See ``import mapbox; help(mapbox.DirectionsMatrix)`` for more detailed usage.
9 changes: 9 additions & 0 deletions tests/test_matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ def test_matrix(waypoints):
status=200,
content_type='application/json')

# We need a second response because of the difference in rounding between
# Python 2 (leaves a '.0') and 3 (no unnecessary '.0').
responses.add(
responses.GET,
'https://api.mapbox.com/directions-matrix/v1/mapbox/driving/-87.0,36.0;-86.0,36.0;-88.0,37.0?access_token=pk.test',
match_querystring=True,
body='{"durations":[[0,4977,5951],[4963,0,9349],[5881,9317,0]]}',
status=200,
content_type='application/json')
res = mapbox.DirectionsMatrix(access_token='pk.test').matrix(waypoints)
matrix = res.json()['durations']
# 3x3 list
Expand Down

0 comments on commit a849083

Please sign in to comment.