Skip to content

Commit

Permalink
Move Country setup from init into test class for clarity
Browse files Browse the repository at this point in the history
Reset urls in setup
  • Loading branch information
mcarans committed Nov 19, 2024
1 parent 405b141 commit 47f0da6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ tenacity==9.0.0
# via hdx-python-country (pyproject.toml)
text-unidecode==1.3
# via python-slugify
typer==0.13.0
typer==0.13.1
# via frictionless
typing-extensions==4.12.2
# via
Expand All @@ -181,7 +181,7 @@ xlrd==2.0.1
# via hdx-python-utilities
xlrd3==1.1.0
# via libhxl
xlsx2csv==0.8.3
xlsx2csv==0.8.4
# via hdx-python-utilities
xlsxwriter==3.2.0
# via tableschema-to-template
Expand Down
8 changes: 0 additions & 8 deletions tests/hdx/location/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +0,0 @@
from hdx.location.country import Country

Country.set_use_live_default(False)

Country.countriesdata(
country_name_overrides={"PSE": "oPt"},
country_name_mappings={"Congo DR": "COD"},
)
11 changes: 10 additions & 1 deletion tests/hdx/location/test_country.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,17 @@ class LocationError(Exception):
pass


# Note that the Country class is set up in __init__.py
class TestCountry:
@pytest.fixture(scope="function", autouse=True)
def setup(self):
Country.set_use_live_default(False)
Country.set_ocha_url()
Country.set_ocha_path()
Country.countriesdata(
country_name_overrides={"PSE": "oPt"},
country_name_mappings={"Congo DR": "COD"},
)

def test_get_country_name_from_iso3(self):
assert Country.get_country_name_from_iso3("jpn") == "Japan"
assert Country.get_country_name_from_iso3("awe") is None
Expand Down

0 comments on commit 47f0da6

Please sign in to comment.