Skip to content

Add check for a NO_RESULT to GeocodeFarm - #240

Merged
KostyaEsmukov merged 5 commits into
geopy:masterfrom
pembo13:issues/239
Apr 24, 2018
Merged

KostyaEsmukov merged 5 commits into
geopy:masterfrom
pembo13:issues/239

Conversation

@pembo13

@pembo13 pembo13 commented Apr 11, 2017

Copy link
Copy Markdown
Contributor

Issue #239

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

@KostyaEsmukov KostyaEsmukov left a comment

Copy link
Copy Markdown
Member

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

pembo13 commented Mar 26, 2018

Copy link
Copy Markdown
Contributor Author

@KostyaEsmukov test added in 6d8d023

in the api response.
"""
status_result = geocoding_results.get("STATUS", {})
if "NO_RESULTS" in status_result.get("status", ""): return

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread test/geocoders/geocodefarm.py Outdated

def test_no_results(self):
"""
GeocodeFarm unhandled error

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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

@KostyaEsmukov KostyaEsmukov left a comment

Copy link
Copy Markdown
Member

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