mirror of
https://github.com/bblaz/num2words.git
synced 2025-12-06 06:42:25 +00:00
[FIX]Fixed typo errors and PEP8 errors.
[DEL]Deleted test_case currency.
This commit is contained in:
@@ -19,6 +19,7 @@
|
||||
from __future__ import unicode_literals, print_function
|
||||
from .lang_EU import Num2Word_EU
|
||||
|
||||
|
||||
class Num2Word_ES(Num2Word_EU):
|
||||
|
||||
# //CHECK: Is this sufficient??
|
||||
@@ -28,7 +29,6 @@ class Num2Word_ES(Num2Word_EU):
|
||||
for word, n in zip(high, range(max, 3, -6)):
|
||||
self.cards[10**(n-3)] = word + "illón"
|
||||
|
||||
|
||||
def setup(self):
|
||||
lows = ["cuatr", "tr", "b", "m"]
|
||||
self.high_numwords = self.gen_high_numwords([], [], lows)
|
||||
@@ -81,7 +81,6 @@ class Num2Word_ES(Num2Word_EU):
|
||||
1e12 : "trillonésim",
|
||||
1e15 : "cuadrillonésim" }
|
||||
|
||||
|
||||
def merge(self, curr, next):
|
||||
ctext, cnum, ntext, nnum = curr + next
|
||||
|
||||
@@ -113,7 +112,6 @@ class Num2Word_ES(Num2Word_EU):
|
||||
|
||||
return (ctext + ntext, cnum * nnum)
|
||||
|
||||
|
||||
def to_ordinal(self, value):
|
||||
self.verify_ordinal(value)
|
||||
text = ""
|
||||
@@ -151,7 +149,6 @@ class Num2Word_ES(Num2Word_EU):
|
||||
self.verify_ordinal(value)
|
||||
return "%s%s" % (value, "º" if self.gender_stem == 'o' else "ª")
|
||||
|
||||
|
||||
def to_currency(self, val, longval=True, old=False):
|
||||
if old:
|
||||
return self.to_splitnum(val, hightxt="peso/s", lowtxt="peseta/s",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
# Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
|
||||
|
||||
# This library is free software; you can redistribute it and/or
|
||||
@@ -33,7 +34,7 @@ class Num2WordsESTest(TestCase):
|
||||
(19, 'diecinueve'),
|
||||
(20, 'veinte'),
|
||||
(21, 'veintiuno'),
|
||||
(26,'veintiseis'),
|
||||
(26, 'veintiséis'),
|
||||
(28, 'vientiocho'),
|
||||
(30, 'treinta'),
|
||||
(31, 'treinta y uno'),
|
||||
@@ -72,9 +73,8 @@ class Num2WordsESTest(TestCase):
|
||||
(7232, 'siete mil docientos treinta y dos'),
|
||||
(8569, 'ocho mil quinientos sesenta y nueve'),
|
||||
(9539, 'nueve mil quinientos treinta y nueve'),
|
||||
(1000000,'un millon'),
|
||||
(1000001,'un millon uno'),
|
||||
# (1000000100,'un miliardocento'), # DOES NOT WORK TODO: FIX
|
||||
(1000000, 'un millón'),
|
||||
(1000001, 'un millón uno'),
|
||||
)
|
||||
|
||||
for test in test_cases:
|
||||
@@ -85,23 +85,11 @@ class Num2WordsESTest(TestCase):
|
||||
test_cases = (
|
||||
(1, 'primero'),
|
||||
(8, 'octavo'),
|
||||
(12,'decimo segundo'),
|
||||
(14,'decimo cuarto'),
|
||||
(28,'vigesimo octavo'),
|
||||
(100,'centesimo'),
|
||||
(12, 'décimosegundo'),
|
||||
(14, 'décimo cuarto'),
|
||||
(28, 'vigésimo octavo'),
|
||||
(100, 'centésimo'),
|
||||
)
|
||||
|
||||
for test in test_cases:
|
||||
self.assertEqual(num2words(test[0], lang='es', ordinal=True), test[1])
|
||||
|
||||
def test_currency(self):
|
||||
test_case = (
|
||||
(1, 'una peseta'),
|
||||
(5, 'cinco pesetas'),
|
||||
(18, 'dieciocho pesetas'),
|
||||
(100, 'cien pesetas'),
|
||||
(1000, 'mil pesetas'),
|
||||
)
|
||||
|
||||
for test in test_case:
|
||||
self.assertAlmostEqual(num2words.to_currency(test, lang='es'))
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
# Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
|
||||
|
||||
# This library is free software; you can redistribute it and/or
|
||||
@@ -34,7 +35,7 @@ class Num2WordsESCOTest(TestCase):
|
||||
(19, 'diecinueve'),
|
||||
(20, 'veinte'),
|
||||
(21, 'veintiuno'),
|
||||
(26,'veintiseis'),
|
||||
(26, 'veintiséis'),
|
||||
(28, 'vientiocho'),
|
||||
(30, 'treinta'),
|
||||
(31, 'treinta y uno'),
|
||||
@@ -73,9 +74,8 @@ class Num2WordsESCOTest(TestCase):
|
||||
(7232, 'siete mil docientos treinta y dos'),
|
||||
(8569, 'ocho mil quinientos sesenta y nueve'),
|
||||
(9539, 'nueve mil quinientos treinta y nueve'),
|
||||
(1000000,'un millon'),
|
||||
(1000001,'un millon uno'),
|
||||
# (1000000100,'un miliardocento'), # DOES NOT WORK TODO: FIX
|
||||
(1000000, 'un millón'),
|
||||
(1000001, 'un millón uno'),
|
||||
)
|
||||
|
||||
for test in test_cases:
|
||||
@@ -86,23 +86,11 @@ class Num2WordsESCOTest(TestCase):
|
||||
test_cases = (
|
||||
(1, 'primero'),
|
||||
(8, 'octavo'),
|
||||
(12,'decimo segundo'),
|
||||
(14,'decimo cuarto'),
|
||||
(28,'vigesimo octavo'),
|
||||
(100,'centesimo'),
|
||||
(12, 'décimo segundo'),
|
||||
(14, 'décimo cuarto'),
|
||||
(28, 'vigésimo octavo'),
|
||||
(100, 'centésimo'),
|
||||
)
|
||||
|
||||
for test in test_cases:
|
||||
self.assertEqual(num2words(test[0], lang='es_CO', ordinal=True), test[1])
|
||||
|
||||
def test_currency(self):
|
||||
test_case = (
|
||||
(1, 'un peso'),
|
||||
(5, 'cinco pesos'),
|
||||
(18, 'dieciocho pesos'),
|
||||
(100, 'cien pesos'),
|
||||
(1000, 'mil pesos'),
|
||||
)
|
||||
|
||||
for test in test_case:
|
||||
self.assertAlmostEqual(num2words.to_currency(test, lang='es_CO'))
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# encoding: UTF-8
|
||||
# Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
|
||||
|
||||
# This library is free software; you can redistribute it and/or
|
||||
@@ -34,7 +35,7 @@ class Num2WordsESVETest(TestCase):
|
||||
(19, 'diecinueve'),
|
||||
(20, 'veinte'),
|
||||
(21, 'veintiuno'),
|
||||
(26,'veintiseis'),
|
||||
(26, 'veintiséis'),
|
||||
(28, 'vientiocho'),
|
||||
(30, 'treinta'),
|
||||
(31, 'treinta y uno'),
|
||||
@@ -73,9 +74,8 @@ class Num2WordsESVETest(TestCase):
|
||||
(7232, 'siete mil docientos treinta y dos'),
|
||||
(8569, 'ocho mil quinientos sesenta y nueve'),
|
||||
(9539, 'nueve mil quinientos treinta y nueve'),
|
||||
(1000000,'un millon'),
|
||||
(1000001,'un millon uno'),
|
||||
# (1000000100,'un miliardocento'), # DOES NOT WORK TODO: FIX
|
||||
(1000000, 'un millón'),
|
||||
(1000001, 'un millón uno'),
|
||||
)
|
||||
|
||||
for test in test_cases:
|
||||
@@ -86,23 +86,12 @@ class Num2WordsESVETest(TestCase):
|
||||
test_cases = (
|
||||
(1, 'primero'),
|
||||
(8, 'octavo'),
|
||||
(12,'decimo segundo'),
|
||||
(14,'decimo cuarto'),
|
||||
(28,'vigesimo octavo'),
|
||||
(100,'centesimo'),
|
||||
(12, 'décimo segundo'),
|
||||
(14, 'décimo cuarto'),
|
||||
(28, 'vigésimo octavo'),
|
||||
(100, 'centésimo'),
|
||||
)
|
||||
|
||||
for test in test_cases:
|
||||
self.assertEqual(num2words(test[0], lang='es_VE', ordinal=True), test[1])
|
||||
|
||||
def test_currency(self):
|
||||
test_case = (
|
||||
(1, 'un bolivar fuerte'),
|
||||
(5, 'cinco bolivares fuertes'),
|
||||
(18, 'dieciocho bolivares fuertes'),
|
||||
(100, 'cien bolivares fuertes'),
|
||||
(1000, 'mil bolivares fuertes'),
|
||||
)
|
||||
|
||||
for test in test_case:
|
||||
self.assertAlmostEqual(num2words.to_currency(test, lang='es_VE'))
|
||||
|
||||
Reference in New Issue
Block a user