mirror of
https://github.com/bblaz/num2words.git
synced 2025-12-06 06:42:25 +00:00
More tests
This commit is contained in:
@@ -22,7 +22,7 @@ from .lang_EU import Num2Word_EU
|
||||
|
||||
class Num2Word_NL(Num2Word_EU):
|
||||
CURRENCY_FORMS = {
|
||||
'EUR': (('euro', 'euro'), ('cent', 'cents')),
|
||||
'EUR': (('euro', 'euros'), ('cent', 'cents')),
|
||||
}
|
||||
|
||||
GIGA_SUFFIX = "iljard"
|
||||
@@ -119,7 +119,7 @@ class Num2Word_NL(Num2Word_EU):
|
||||
val = cnum + nnum
|
||||
|
||||
word = ctext + ntext
|
||||
return (word, val)
|
||||
return word, val
|
||||
|
||||
def to_ordinal(self, value):
|
||||
self.verify_ordinal(value)
|
||||
|
||||
@@ -19,6 +19,7 @@ from __future__ import unicode_literals
|
||||
from unittest import TestCase
|
||||
|
||||
from num2words import num2words
|
||||
from num2words.lang_NL import Num2Word_NL
|
||||
|
||||
|
||||
class Num2WordsNLTest(TestCase):
|
||||
@@ -87,3 +88,20 @@ class Num2WordsNLTest(TestCase):
|
||||
num2words('4778.00', lang='nl', to='currency', seperator=' en',
|
||||
cents=True, currency='EUR'),
|
||||
'vierduizendzevenhonderdachtenzeventig euro en nul cent')
|
||||
|
||||
def test_pluralize(self):
|
||||
n = Num2Word_NL()
|
||||
# euros always singular
|
||||
cr1, cr2 = n.CURRENCY_FORMS['EUR']
|
||||
self.assertEqual(n.pluralize(1, cr1), 'euro')
|
||||
self.assertEqual(n.pluralize(2, cr1), 'euro')
|
||||
self.assertEqual(n.pluralize(1, cr2), 'cent')
|
||||
self.assertEqual(n.pluralize(2, cr2), 'cent')
|
||||
|
||||
# @TODO other currency
|
||||
|
||||
def test_to_year(self):
|
||||
self.assertEqual(num2words(2018, lang='nl', to='year'),
|
||||
'tweeduizendachttien')
|
||||
self.assertEqual(num2words(2100, lang='nl', to='year'),
|
||||
'eenentwintig honderd')
|
||||
|
||||
Reference in New Issue
Block a user