def test_ls_reverse_geocoding(): """Test reverse geocoding.""" ls = LS(api_key=LS_API_KEY) resp = ls.reverse_geocode(lat=19.1646, lng=72.8493) address = resp.items[0]["address"]["label"] assert "Goregaon" in address resp1 = ls.reverse_geocode(lat=19.1646, lng=72.8493, limit=4) assert len(resp1.items) == 4
def test_ls_reverse_geocoding(): """Test reverse geocoding.""" ls = LS(api_key=LS_API_KEY) resp = ls.reverse_geocode(lat=19.1646, lng=72.8493) address = resp.items[0]["address"]["label"] assert ( address == "Goregaon East Railway Station(East ENT), Goregaon West, Mumbai 400062, India" ) resp1 = ls.reverse_geocode(lat=19.1646, lng=72.8493, limit=4) assert len(resp1.items) == 4
def test_ls_reverse_geocoding_exception(): """Test reverse geocoding api exception.""" ls = LS(api_key=LS_API_KEY) with pytest.raises(ValueError): ls.reverse_geocode(lat=91, lng=90) with pytest.raises(ValueError): ls.reverse_geocode(lat=19, lng=190) ls = LS(api_key="dummy") with pytest.raises(ApiError): ls.reverse_geocode(lat=19.1646, lng=72.8493)