Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@izhyk
Copy link

@izhyk izhyk commented Aug 11, 2018

this commit fixes #157

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.

Thanks! I left some notes below, could you please address them?

Ignore the failed Travis build for py3.7 – that looks like a Travis fault; it's definitely not caused by your code.

language=False,
geometry=None
geometry=None,
extratags=True,
Copy link
Member

Choose a reason for hiding this comment

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

Could you please keep the old behavior (i.e. set the default value to False)? The extra info is rarely needed, so defaulting that to True means some pointlessly wasted cpu and network resources.

:param bool extratags: Include additional information in the result if available,
e.g. wikipedia link, opening hours.
Copy link
Member

Choose a reason for hiding this comment

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

Could you please add the following line:

.. versionadded:: 1.17.0


def test_extratags(self):
"""
Nominatim.geocode using `extratags`
Copy link
Member

Choose a reason for hiding this comment

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

This docstring is not needed as it restates the test method name.

"""
Nominatim.geocode using `extratags`
"""
geocoder = Nominatim(user_agent='my_user_agent/1.0')
Copy link
Member

Choose a reason for hiding this comment

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

The tests above use self.make_geocoder() for creating an instance of geocoder. This is important, because this test class is an abstract class which tests not just Nominatim, but also other Nominatim-based geocoders (e.g. Pickpoint and OpenMapQuest), which instances are returned by the overridden make_geocoder methods in the specific test cases.

_make_request usage is also discouraged. The same could be achieved with the following (which also doesn't require creating a new geocoder instance):

query = "175 5th Avenue NYC"

location = self.geocode_run(
    {"query": query},
    {},
)
self.assertIsNone(result.raw.get('extratags'))

location = self.geocode_run(
    {"query": query, "extratags": True},
    {},
)
self.assertEqual(result.raw['extratags']['wikidata'], 'Q220728')

@KostyaEsmukov KostyaEsmukov added this to the 1.17 milestone Aug 12, 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.

Perfect, thank you!

@KostyaEsmukov KostyaEsmukov merged commit d0e5602 into geopy:master Aug 22, 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.

How to set the extratags of Nominatim to True?

3 participants