-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aa91978
commit da761f6
Showing
7 changed files
with
96 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import absolute_import, division, print_function, unicode_literals | ||
|
||
import iso4217parse | ||
|
||
|
||
def test_invalid(): | ||
assert iso4217parse.by_alpha3(None) is None | ||
assert iso4217parse.by_alpha3(1234) is None | ||
assert iso4217parse.by_alpha3('Blaa') is None | ||
|
||
|
||
def test_all_currencies(): | ||
for code in iso4217parse._data()['alpha3'].keys(): | ||
assert isinstance(iso4217parse.by_alpha3(code), iso4217parse.Currency) | ||
|
||
|
||
def test_examples(): | ||
exp = iso4217parse.Currency(alpha3='CHF', code_num=756, name='Swiss franc', | ||
symbols=['SFr.', 'fr', 'Fr.', 'F', 'franc', 'francs', 'Franc', 'Francs'], | ||
minor=2, countries=['CH', 'LI']) | ||
assert exp == iso4217parse.by_alpha3('CHF') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import absolute_import, division, print_function, unicode_literals | ||
|
||
import iso4217parse | ||
|
||
|
||
def test_invalid(): | ||
assert iso4217parse.by_code_num(None) is None | ||
assert iso4217parse.by_code_num(1234) is None | ||
assert iso4217parse.by_code_num('Blaa') is None | ||
|
||
|
||
def test_all_currencies(): | ||
for code in iso4217parse._data()['code_num'].keys(): | ||
assert isinstance(iso4217parse.by_code_num(code), iso4217parse.Currency) | ||
|
||
|
||
def test_examples(): | ||
exp = iso4217parse.Currency(alpha3='AMD', code_num=51, name='Armenian dram', | ||
symbols=['֏', 'դր', 'dram'], minor=2, countries=['AM']) | ||
assert exp == iso4217parse.by_code_num(51) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import absolute_import, division, print_function, unicode_literals | ||
|
||
import iso3166 | ||
import iso4217parse | ||
|
||
|
||
def test_invalid(): | ||
assert iso4217parse.by_country(None) is None | ||
assert iso4217parse.by_country(1234) is None | ||
assert iso4217parse.by_country('Blaa') is None | ||
|
||
|
||
def test_all_countries(): | ||
for country in iso3166._records: | ||
if 'AQ' == country.alpha2: # ignore Antarctica | ||
continue | ||
cs = iso4217parse.by_country(country.alpha2) | ||
if cs is None: | ||
print(country.alpha2, country) | ||
# assert isinstance(cs, list) | ||
# assert len(cs) > 0 | ||
|
||
|
||
def test_examples(): | ||
exp = [ | ||
iso4217parse.Currency(alpha3='HKD', code_num=344, name='Hong Kong dollar', | ||
symbols=['HK$', 'HK$', '$', '$', 'dollar', 'dollars', 'Dollar', 'Dollars', 'HK﹩', '﹩', '元'], | ||
minor=2, countries=['HK']), | ||
iso4217parse.Currency(alpha3='CNH', code_num=None, name='Chinese yuan', | ||
symbols=['CN¥', '¥', 'CN¥', '¥', 'RMB', '元'], | ||
minor=2, countries=['HK']) | ||
] | ||
assert exp == iso4217parse.by_country('HK') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters