Esempio n. 1
0
def test_examples_EUR():
    exp = iso4217.Currency(
        alpha3='EUR',
        code_num=978,
        name='Euro',
        symbols=['€', 'euro', 'euros'],
        minor=2,
        countries=[
            'AD', 'AT', 'AX', 'BE', 'BL', 'CY', 'DE', 'EE', 'ES', 'FI', 'FR',
            'GF', 'GP', 'GR', 'IE', 'IT', 'LT', 'LU', 'LV', 'MC', 'ME', 'MF',
            'MQ', 'MT', 'NL', 'PM', 'PT', 'RE', 'SI', 'SK', 'SM', 'TF', 'VA',
            'XK', 'YT'
        ],
    )

    assert [exp] == iso4217.parse('Price is 5 €')
    assert [exp] == iso4217.parse('Price is 5 EUR')
    assert [exp] == iso4217.parse('Price is 5 eur')
    assert [exp] == iso4217.parse('Price is 5 euro')
    assert [exp] == iso4217.parse('Price is 5 Euro')

    exp = iso4217.Currency(
        alpha3='CAD',
        code_num=124,
        name='Canadian dollar',
        symbols=[
            'CA$', 'CA$', '$', '$', 'dollar', 'dollars', 'Dollar', 'Dollars',
            'CA﹩', '﹩'
        ],
        minor=2,
        countries=['CA'],
    )

    assert [exp] == iso4217.parse('CA﹩15.76')
Esempio n. 2
0
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)
Esempio n. 3
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')
Esempio n. 4
0
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')
Esempio n. 5
0
def test_examples():
    exp = iso4217.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] == iso4217.parse('CHF')

    exp = iso4217.Currency(
        alpha3='CUP',
        code_num=192,
        name='Cuban peso',
        symbols=[
            '₱', '$', '﹩', '$', 'dollar', 'dollars', 'Dollar', 'Dollars',
            '$MN', '﹩MN', '$MN'
        ],
        minor=2,
        countries=['CU'],
    )

    assert [exp] == iso4217.parse(192)

    exp = iso4217.Currency(
        alpha3='EUR',
        code_num=978,
        name='Euro',
        symbols=['€', 'euro', 'euros'],
        minor=2,
        countries=[
            'AD', 'AT', 'AX', 'BE', 'BL', 'CY', 'DE', 'EE', 'ES', 'FI', 'FR',
            'GF', 'GP', 'GR', 'IE', 'IT', 'LT', 'LU', 'LV', 'MC', 'ME', 'MF',
            'MQ', 'MT', 'NL', 'PM', 'PT', 'RE', 'SI', 'SK', 'SM', 'TF', 'VA',
            'XK', 'YT'
        ],
    )

    assert [exp] == iso4217.parse('Price is 5 €')
    assert [exp] == iso4217.parse('Price is 5 EUR')
    assert [exp] == iso4217.parse('Price is 5 eur')
    assert [exp] == iso4217.parse('Price is 5 euro')
    assert [exp] == iso4217.parse('Price is 5 Euro')

    exp = iso4217.Currency(
        alpha3='CAD',
        code_num=124,
        name='Canadian dollar',
        symbols=[
            'CA$', 'CA$', '$', '$', 'dollar', 'dollars', 'Dollar', 'Dollars',
            'CA﹩', '﹩'
        ],
        minor=2,
        countries=['CA'],
    )

    assert [exp] == iso4217.parse('CA﹩15.76')