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

direction validate_snapping behavior differs by Python version #238

Closed
perrygeo opened this issue May 31, 2018 · 0 comments · Fixed by #239
Closed

direction validate_snapping behavior differs by Python version #238

perrygeo opened this issue May 31, 2018 · 0 comments · Fixed by #239
Labels
Milestone

Comments

@perrygeo
Copy link
Contributor

Another fun Python 2/3 issue

The _validate_snapping method returns (bearings, radii) tuples.

In Python 3, we get the correct behavior

>>> from mapbox.services import directions
>>> d = directions.Directions()
>>> d._validate_snapping([(1, 1, 1), u'unlimited'], [None, None])
([(1, 1), None], [1, 'unlimited'])

In Python 2, we get an Expection

>>> from mapbox.services import directions
>>> d = directions.Directions()
>>> d._validate_snapping([(1, 1, 1), u'unlimited'], [None, None])
------------------------------------------------------------------------
InvalidParameterError                  Traceback (most recent call last)
<ipython-input-3-1dc0bc40d399> in <module>()
----> 1 d._validate_snapping([(1, 1, 1), u'unlimited'], [None, None])

/Users/mperry/env/sdk27/lib/python2.7/site-packages/mapbox/services/directions.pyc in _validate_snapping(self, snaps, features)
     93                     except ValueError:
     94                         raise errors.InvalidParameterError(
---> 95                             'waypoint snapping should contain 3 elements: '
     96                             '(bearing, angle, range)')
     97                     self._validate_radius(radius)

InvalidParameterError: waypoint snapping should contain 3 elements: (bearing, angle, range)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant