Increase test coverage for lang fr* (#136)

Ref: issues #116 #121 #127
This commit is contained in:
Ernesto Rodriguez Ortiz
2017-11-09 10:15:29 -05:00
committed by GitHub
parent 1e954c909b
commit 9819498a14
6 changed files with 269 additions and 88 deletions

View File

@@ -90,31 +90,8 @@ class Num2Word_FR(Num2Word_EU):
return out
def to_currency(self, val, longval=True, old=False):
hightxt = "Euro/s"
hightxt = "euro/s"
if old:
hightxt = "franc/s"
return self.to_splitnum(val, hightxt=hightxt, lowtxt="centime/s",
jointxt="et", longval=longval)
n2w = Num2Word_FR()
to_card = n2w.to_cardinal
to_ord = n2w.to_ordinal
to_ordnum = n2w.to_ordinal_num
def main():
for val in [1, 11, 12, 21, 31, 33, 71, 80, 81, 91, 99, 100, 101, 102, 155,
180, 300, 308, 832, 1000, 1001, 1061, 1100, 1500, 1701, 3000,
8280, 8291, 150000, 500000, 1000000, 2000000, 2000001,
-21212121211221211111, -2.121212, -1.0000100]:
n2w.test(val)
n2w.test(
1325325436067876801768700107601001012212132143210473207540327057320957)
print(n2w.to_currency(112121))
print(n2w.to_year(1996))
if __name__ == "__main__":
main()
divisor=1, jointxt="et", longval=longval)

View File

@@ -47,26 +47,3 @@ class Num2Word_FR_CH(Num2Word_FR):
if nnum > cnum:
return ("%s %s" % (ctext, ntext), cnum * nnum)
return ("%s %s" % (ctext, ntext), cnum + nnum)
n2w = Num2Word_FR_CH()
to_card = n2w.to_cardinal
to_ord = n2w.to_ordinal
to_ordnum = n2w.to_ordinal_num
def main():
for val in [1, 11, 12, 21, 31, 33, 71, 80, 81, 91, 99, 100, 101, 102, 155,
180, 300, 308, 832, 1000, 1001, 1061, 1100, 1500, 1701, 3000,
8280, 8291, 150000, 500000, 1000000, 2000000, 2000001,
-21212121211221211111, -2.121212, -1.0000100]:
n2w.test(val)
n2w.test(
1325325436067876801768700107601001012212132143210473207540327057320950)
print(n2w.to_currency(112121))
print(n2w.to_year(1996))
if __name__ == "__main__":
main()

View File

@@ -21,31 +21,7 @@ from .lang_FR import Num2Word_FR
class Num2Word_FR_DZ(Num2Word_FR):
def to_currency(self, val, longval=True, cents=True, jointxt="virgule"):
return self.to_splitnum(val, hightxt="dinard/s", lowtxt="centime/s",
jointxt=jointxt, longval=longval, cents=cents)
n2w = Num2Word_FR_DZ()
to_card = n2w.to_cardinal
to_ord = n2w.to_ordinal
to_ordnum = n2w.to_ordinal_num
to_year = n2w.to_year
to_currency = n2w.to_currency
def main():
for val in [1, 11, 12, 21, 31, 33, 71, 80, 81, 91, 99, 100, 101, 102, 155,
180, 300, 308, 832, 1000, 1001, 1061, 1100, 1500, 1701, 3000,
8280, 8291, 150000, 500000, 1000000, 2000000, 2000001,
-21212121211221211111, -2.121212, -1.0000100]:
n2w.test(val)
n2w.test(
1325325436067876801768700107601001012212132143210473207540327057320950)
for val in [1, 120, 1000, 1120, 1800, 1976, 2000, 2010, 2099, 2171]:
print(val, "is", n2w.to_currency(val))
print(val, "is", n2w.to_year(val))
if __name__ == "__main__":
main()
return self.to_splitnum(
val, hightxt="dinard/s", lowtxt="centime/s", divisor=1,
jointxt=jointxt, longval=longval, cents=cents
)