Use 5.0.0 of databridges REST API directly #249
GitHub Actions / Test Results
failed
Oct 30, 2024 in 0s
1 fail, 30 pass in 2m 52s
31 tests 30 ✅ 2m 52s ⏱️
1 suites 0 💤
1 files 1 ❌
Results for commit daec984.
Annotations
Check warning on line 0 in tests.hdx.location.test_adminlevel.TestAdminLevel
github-actions / Test Results
test_adminlevel_with_url (tests.hdx.location.test_adminlevel.TestAdminLevel) failed
test-results.xml [took 4s]
Raw output
AssertionError: assert 2526 == 2510
+ where 2526 = len(['AF01', 'AF02', 'AF03', 'AF04', 'AF05', 'AF06', ...])
+ where ['AF01', 'AF02', 'AF03', 'AF04', 'AF05', 'AF06', ...] = get_pcode_list()
+ where get_pcode_list = <hdx.location.adminlevel.AdminLevel object at 0x7feb64f47cb0>.get_pcode_list
self = <location.test_adminlevel.TestAdminLevel object at 0x7feb6556e3c0>
config = {'admin_info': [{'pcode': 'AF01', 'name': 'Kabul', 'iso3': 'AFG'}, {'pcode': 'AF02', 'name': 'Kapisa', 'iso3': 'AFG'},...': 'Paghman', 'iso3': 'AFG', 'parent': 'AF01'}, {'pcode': 'AF0201', 'name': 'Kabul', 'iso3': 'AFG', 'parent': 'AF02'}]}
url = 'tests/fixtures/download-global-pcodes-adm-1-2.csv'
fixtures_dir = 'tests/fixtures'
def test_adminlevel_with_url(self, config, url, fixtures_dir):
adminone = AdminLevel(config, admin_level_overrides={"YEM": 5})
assert adminone.get_admin_level("YEM") == 5
with pytest.raises(FileNotFoundError):
adminone.setup_from_url("fake_url")
adminone = AdminLevel(config)
AdminLevel.set_default_admin_url()
assert AdminLevel.admin_url == AdminLevel._admin_url_default
AdminLevel.set_default_admin_url(url)
assert AdminLevel.admin_url == url
adminone.setup_from_url(countryiso3s=("YEM",))
assert len(adminone.get_pcode_list()) == 22
with temp_dir(
"TestAdminLevelRetriever",
delete_on_success=True,
delete_on_failure=False,
) as tempdir:
with Download(user_agent="test") as downloader:
retriever = Retrieve(
downloader,
tempdir,
fixtures_dir,
tempdir,
save=False,
use_saved=False,
)
adminone = AdminLevel(config, retriever=retriever)
with pytest.raises(DownloadError):
adminone.setup_from_url("fake_url")
retriever = Retrieve(
downloader,
tempdir,
fixtures_dir,
tempdir,
save=False,
use_saved=True,
)
adminone = AdminLevel(config, retriever=retriever)
with pytest.raises(FileNotFoundError):
adminone.setup_from_url("fake_url")
adminone.setup_from_url(countryiso3s=("YEM",))
assert len(adminone.get_pcode_list()) == 22
adminone = AdminLevel(config)
adminone.setup_from_url()
assert adminone.get_admin_level("YEM") == 1
> assert len(adminone.get_pcode_list()) == 2510
E AssertionError: assert 2526 == 2510
E + where 2526 = len(['AF01', 'AF02', 'AF03', 'AF04', 'AF05', 'AF06', ...])
E + where ['AF01', 'AF02', 'AF03', 'AF04', 'AF05', 'AF06', ...] = get_pcode_list()
E + where get_pcode_list = <hdx.location.adminlevel.AdminLevel object at 0x7feb64f47cb0>.get_pcode_list
tests/hdx/location/test_adminlevel.py:424: AssertionError
Loading