-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathtest_listings.py
More file actions
38 lines (26 loc) · 1.08 KB
/
test_listings.py
File metadata and controls
38 lines (26 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import iso3166
def test_country_list() -> None:
country_list = iso3166.countries
assert len(country_list) > 100
assert all(isinstance(c, iso3166.Country) for c in country_list)
def test_by_name() -> None:
table = iso3166.countries_by_name
assert len(table) >= len(iso3166.countries)
assert table["AFGHANISTAN"].name == "Afghanistan"
def test_by_alt_name() -> None:
table = iso3166.countries_by_apolitical_name
assert len(table) >= len(iso3166.countries)
assert table["AFGHANISTAN"].name == "Afghanistan"
assert table["TAIWAN"].apolitical_name == "Taiwan"
def test_by_number() -> None:
table = iso3166.countries_by_numeric
assert len(table) >= len(iso3166.countries)
assert table["008"].name == "Albania"
def test_by_alpha2() -> None:
table = iso3166.countries_by_alpha2
assert len(table) >= len(iso3166.countries)
assert table["AE"].name == "United Arab Emirates"
def test_by_alpha3() -> None:
table = iso3166.countries_by_alpha3
assert len(table) >= len(iso3166.countries)
assert table["AFG"].name == "Afghanistan"