8000 Add check for a NO_RESULT to GeocodeFarm by pembo13 · Pull Request #240 · geopy/geopy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add check for a NO_RESULT to GeocodeFarm #240

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

Merged
merged 5 commits into from
Apr 24, 2018
Merged

Add check for a NO_RESULT to GeocodeFarm #240

merged 5 commits into from
Apr 24, 2018

Conversation

pembo13
Copy link
Contributor
@pembo13 pembo13 commented Apr 11, 2017

Issue #239

Added two lines to check for the NO_RESULTS status from webservice and return None instead of an exception.

Copy link
Member
@KostyaEsmukov KostyaEsmukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May I ask you to add a test for this change? Thanks in advance.

@pembo13
Copy link
Contributor Author
pembo13 commented Mar 26, 2018

@KostyaEsmukov test added in 6d8d023

@@ -159,6 +161,7 @@ def _check_for_api_errors(geocoding_results):
in the api response.
"""
status_result = geocoding_results.get("STATUS", {})
if "NO_RESULTS" in status_result.get("status", ""): return
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason to have this check here? If there's none, I suggest to remove this line.

As far as I can see the following two lines shouldn't misbehave even when the status contains NO_RESULTS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, if I'm being honest this was long enough ago that I forgot my rational for the double lines... I'll figure that out and cleanup.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaEsmukov I double checked, both checks are necessary.

@@ -96,6 +96,35 @@ def mock_call_geocoder(*args, **kwargs):
with self.assertRaises(exc.GeocoderQuotaExceeded):
self.geocoder.geocode('435 north michigan ave, chicago il 60611')

def test_no_results(self):
"""
GeocodeFarm unhandled error
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is clearly a copy-paste from another test. You can remove this comment completely (instead of updating it), because after switch to pytest (#266) they all will be removed anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I wanted to emulate existing tests instead of reinventing unnecessarily... I was sloppy and missed that comment. Will remove.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KostyaEsmukov removed that comment

@KostyaEsmukov KostyaEsmukov added this to the 1.14 milestone Apr 8, 2018
Copy link
Member
@KostyaEsmukov KostyaEsmukov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging. Thank you!

@KostyaEsmukov KostyaEsmukov merged commit 1eae476 into geopy:master Apr 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0