Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Administrative area bug fix #19

Merged
merged 2 commits into from
Jul 26, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions geolocation/geocode/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class LocationModel(object):
_administrative_area = list()

def __init__(self, **kwargs):
self.city = kwargs.get('city')
Expand All @@ -14,6 +13,7 @@ def __init__(self, **kwargs):
self.lat = kwargs.get('lat')
self.lng = kwargs.get('lng')
self.formatted_address = kwargs.get('formatted_address')
self._administrative_area = list()

def __repr__(self):
return '<LocationModel: %s>' % self.city
Expand All @@ -35,4 +35,4 @@ def __init__(self, area_type, name):
self.name = name

def __repr__(self):
return '<AdministrativeAreaLevelModel: %s>' % self.name
return '<AdministrativeAreaLevelModel: %s>' % self.name
15 changes: 14 additions & 1 deletion tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ def test_latlng(self):

self.assertEqual('Mountain View', my_location.city.decode('utf-8'))

def test_administrative_area_resets(self):
address = "São Paulo"
sao_paulo = self.google_maps.search(address).first()

address = "Houston, TX"
houston = self.google_maps.search(address).first()

self.assertNotEqual(sao_paulo, houston)


class DistanceMatrixTest(unittest.TestCase):
def setUp(self):
Expand Down Expand Up @@ -212,4 +221,8 @@ def test_distance_matrix_avoid_ferries(self):
self.assertEqual(item.distance.kilometers, 1851)
self.assertEqual(item.distance.meters, 1851000)
self.assertEqual(item.distance.miles, 1150.1559)
self.assertEqual(str(item.duration), '0d 17h 35m 44s')
self.assertEqual(str(item.duration), '0d 17h 35m 44s')


if __name__ == '__main__':
unittest.main()