Python pycountry.currencies() Examples
The following are 5
code examples of pycountry.currencies().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pycountry
, or try the search function
.
Example #1
Source File: test_general.py From bazarr with GNU General Public License v3.0 | 6 votes |
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)
Example #2
Source File: test_general.py From pycountry with GNU Lesser General Public License v2.1 | 5 votes |
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'
Example #3
Source File: test_general.py From pycountry with GNU Lesser General Public License v2.1 | 5 votes |
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)
Example #4
Source File: 0001_squashed_0011_auto_20161101_2207.py From course-discovery with GNU Affero General Public License v3.0 | 5 votes |
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')] )
Example #5
Source File: test_general.py From bazarr with GNU General Public License v3.0 | 5 votes |
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'