Skip to content

Commit

Permalink
Merge pull request #19 from brendanebers/master
Browse files Browse the repository at this point in the history
Administrative area bug fix
  • Loading branch information
slawek87 committed Jul 26, 2015
2 parents 94899d7 + 0642714 commit 9b0995d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
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()

0 comments on commit 9b0995d

Please sign in to comment.