当前位置: 首页>>代码示例>>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;未经允许,请勿转载。