當前位置: 首頁>>代碼示例>>Python>>正文


Python pycountry.currencies方法代碼示例

本文整理匯總了Python中pycountry.currencies方法的典型用法代碼示例。如果您正苦於以下問題:Python pycountry.currencies方法的具體用法?Python pycountry.currencies怎麽用?Python pycountry.currencies使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pycountry的用法示例。


在下文中一共展示了pycountry.currencies方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_lookup

# 需要導入模塊: import pycountry [as 別名]
# 或者: from pycountry import currencies [as 別名]
def test_lookup():
    c = pycountry.countries
    g = c.get(alpha_2='DE')
    assert g == c.lookup('de')
    assert g == c.lookup('DEU')
    assert g == c.lookup('276')
    assert g == c.lookup('germany')
    assert g == c.lookup('Federal Republic of Germany')
    # try a generated field
    bqaq = pycountry.historic_countries.get(alpha_4='BQAQ')
    assert bqaq == pycountry.historic_countries.lookup('atb')
    german = pycountry.languages.get(alpha_2='de')
    assert german == pycountry.languages.lookup('De')
    euro = pycountry.currencies.get(alpha_3='EUR')
    assert euro == pycountry.currencies.lookup('euro')
    latin = pycountry.scripts.get(name='Latin')
    assert latin == pycountry.scripts.lookup('latn')
    al_bu = pycountry.subdivisions.get(code='AL-BU')
    assert al_bu == pycountry.subdivisions.lookup('al-bu')
    with pytest.raises(LookupError):
        pycountry.countries.lookup('bogus country')
    with pytest.raises(LookupError):
        pycountry.countries.lookup(12345) 
開發者ID:morpheus65535,項目名稱:bazarr,代碼行數:25,代碼來源:test_general.py

示例2: test_currencies

# 需要導入模塊: import pycountry [as 別名]
# 或者: from pycountry import currencies [as 別名]
def test_currencies():
    assert len(pycountry.currencies) == 170
    assert isinstance(list(pycountry.currencies)[0], pycountry.db.Data)

    argentine_peso = pycountry.currencies.get(alpha_3='ARS')
    assert argentine_peso.alpha_3 == u'ARS'
    assert argentine_peso.name == u'Argentine Peso'
    assert argentine_peso.numeric == u'032' 
開發者ID:flyingcircusio,項目名稱:pycountry,代碼行數:10,代碼來源:test_general.py

示例3: test_lookup

# 需要導入模塊: import pycountry [as 別名]
# 或者: from pycountry import currencies [as 別名]
def test_lookup():
    c = pycountry.countries
    g = c.get(alpha_2='DE')
    assert g == c.get(alpha_2='de')
    assert g == c.lookup('de')
    assert g == c.lookup('DEU')
    assert g == c.lookup('276')
    assert g == c.lookup('germany')
    assert g == c.lookup('Federal Republic of Germany')
    # try a generated field
    bqaq = pycountry.historic_countries.get(alpha_4='BQAQ')
    assert bqaq == pycountry.historic_countries.lookup('atb')
    german = pycountry.languages.get(alpha_2='de')
    assert german == pycountry.languages.lookup('De')
    euro = pycountry.currencies.get(alpha_3='EUR')
    assert euro == pycountry.currencies.lookup('euro')
    latin = pycountry.scripts.get(name='Latin')
    assert latin == pycountry.scripts.lookup('latn')
    al_bu = pycountry.subdivisions.get(code='AL-BU')
    assert al_bu == pycountry.subdivisions.lookup('al-bu')
    with pytest.raises(LookupError):
        pycountry.countries.lookup('bogus country')
    with pytest.raises(LookupError):
        pycountry.countries.lookup(12345)
    with pytest.raises(LookupError):
        pycountry.countries.get(alpha_2=12345) 
開發者ID:flyingcircusio,項目名稱:pycountry,代碼行數:28,代碼來源:test_general.py

示例4: add_currencies

# 需要導入模塊: import pycountry [as 別名]
# 或者: from pycountry import currencies [as 別名]
def add_currencies(apps, schema_editor):
    """ Populates the currency table.

    Data is pulled from pycountry. X currencies are not included given their limited use, and a desire
    to limit the size of the options displayed in Django admin.
    """
    Currency = apps.get_model('core', 'Currency')
    Currency.objects.bulk_create(
        [Currency(code=currency.alpha_3, name=currency.name) for currency in pycountry.currencies if
            not currency.alpha_3.startswith('X')]
    ) 
開發者ID:edx,項目名稱:course-discovery,代碼行數:13,代碼來源:0001_squashed_0011_auto_20161101_2207.py


注:本文中的pycountry.currencies方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。