Skip to content
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

Feature/use gb full #18

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

amarchin
Copy link

  • Add the possibility to use the GB_full file.
  • Create a new class Countries.
  • Add relevant tests.

Copy link
Member

@rth rth left a comment

Choose a reason for hiding this comment

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

Thanks for your PR @amarchin ! A few comments are below.

Also I need to fix CI which is failing for an unrelated issues, will do that in a separate PR..

countries.py Outdated Show resolved Hide resolved
countries.py Outdated Show resolved Hide resolved
test_pgeocode.py Outdated Show resolved Hide resolved
countries.py Outdated Show resolved Hide resolved
test_pgeocode.py Show resolved Hide resolved
@rth
Copy link
Member

rth commented Nov 27, 2019

Please sync with master, the CI should now be fixed and the failing IE test marked as a known failure.

@amarchin
Copy link
Author

amarchin commented Nov 28, 2019

Thank you for your review! I tried to address your comments. Let me know what you think :)

Copy link
Member

@rth rth left a comment

Choose a reason for hiding this comment

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

Thanks! A few last comments otherwise LGTM.

self._data_path, self._data = self._get_data(country)
country_obj = _Country(country)
self.country = country_obj.name
self.download_path = country_obj.get_download_path()
Copy link
Member

Choose a reason for hiding this comment

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

Let's make this private as well,

Suggested change
self.download_path = country_obj.get_download_path()
self._download_path = country_obj.get_download_path()

@@ -26,6 +26,11 @@ def temp_dir():
shutil.rmtree(path)


@pytest.fixture(scope='session')
def country_gb_full():
return pgeocode._Country('gb_full')
Copy link
Member

Choose a reason for hiding this comment

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

Typically session level fixtures are used for expensive operation (e.g. loading the data, or file access operations) once per session run.

To test _Country we should rather initialize it in each test that needs (and not use fixture).



def test_that_get_clean_country_raises_value_error():
with pytest.raises(ValueError):
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
with pytest.raises(ValueError):
with pytest.raises(ValueError, match="not a known country code"):

@pan1c
Copy link

pan1c commented Aug 25, 2023

Hi guys! Is it possible to merge this fix? It would still be great to have the possibility to use GB_full database instead GB

@cimadure
Copy link

@pan1c , the #75 covers it too with other countries and the CI. It has a better chances to pass.

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.

4 participants