예제 #1
0
def translate(number):

    try:
        t = TranslateNumber(number)
        resp = {'extenso': t.translate()}
        return jsonify(resp)

    except TranslateNumberException as e:
        resp = {'error': e.message}
        return jsonify(resp)
def test_number_15012():
    t = TranslateNumber('15012')
    assert t.translate() == 'quinze mil e doze'
def test_number_67329():
    t = TranslateNumber('67329')
    assert t.translate() == 'sessenta e sete mil trezentos e vinte e nove'
def test_number_10110():
    t = TranslateNumber('10110')
    assert t.translate() == 'dez mil cento e dez'
def test_number_6699():
    t = TranslateNumber('-6699')
    assert t.translate() == 'menos seis mil seiscentos e noventa e nove'
def test_number_100():
    t = TranslateNumber('100')
    assert t.translate() == 'cem'
def test_number_0():
    t = TranslateNumber('0')
    assert t.translate() == 'zero'
def test_number_254():
    t = TranslateNumber('254')
    assert t.translate() == 'duzentos e cinquenta e quatro'
def test_number_19():
    t = TranslateNumber('19')
    assert t.translate() == 'dezenove'
def test_number_1():
    t = TranslateNumber('1')
    assert t.translate() == 'um'
def test_number_1000_whiteSpace():
    t = TranslateNumber(' 1000 ')
    assert t.translate() == 'mil'