File: test_listings.py

package info (click to toggle)
python-iso3166 2.1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 120 kB
  • sloc: python: 577; makefile: 4
file content (40 lines) | stat: -rw-r--r-- 1,129 bytes parent folder | download | duplicates (2)
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
39
40
# -*- coding: utf-8 -*-

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"