diff -Nru python-num2words-0.5.9/bin/num2words python-num2words-0.5.10/bin/num2words --- python-num2words-0.5.9/bin/num2words 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/bin/num2words 2019-05-12 15:48:38.000000000 +0000 @@ -55,7 +55,7 @@ from docopt import docopt import num2words -__version__ = "0.5.9" +__version__ = "0.5.10" __license__ = "LGPL" diff -Nru python-num2words-0.5.9/CHANGES.rst python-num2words-0.5.10/CHANGES.rst --- python-num2words-0.5.9/CHANGES.rst 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/CHANGES.rst 2019-05-12 15:48:38.000000000 +0000 @@ -1,6 +1,22 @@ Changelog ========= + +Version 0.5.10 -- 2019/05/12 +---------------------------- + +* Add Kannada language localization (#243) +* Revert some copyrights changed by mistake (#254) +* Add indian rupee to the supported currencies (#248) +* Improve currency functions for German and French (#247) +* Improve Slovene localization (#246) +* Improve Spanish localization (#240) +* Fix typo 'seperator' on source code (#238) +* Convert string to decimal values (#223) +* Improve German localization and test coverage (#237) +* Improve Polish localization (#233) +* Fix ordinal number for French ending on 1 (#236) + Version 0.5.9 -- 2019/01/10 --------------------------- diff -Nru python-num2words-0.5.9/debian/changelog python-num2words-0.5.10/debian/changelog --- python-num2words-0.5.9/debian/changelog 2021-01-19 15:16:13.000000000 +0000 +++ python-num2words-0.5.10/debian/changelog 2021-09-14 10:32:39.000000000 +0000 @@ -1,3 +1,13 @@ +python-num2words (0.5.10-1) unstable; urgency=medium + + * Team upload. + * New upstream release. (Closes: #985024) + * Fix debian/watch for new upstream tag using v prefix + * Update patch for changes in tests/test_cli.py + * Bump standards version, no changes + + -- Neil Williams Tue, 14 Sep 2021 11:32:39 +0100 + python-num2words (0.5.9-1) unstable; urgency=medium * Team upload. diff -Nru python-num2words-0.5.9/debian/control python-num2words-0.5.10/debian/control --- python-num2words-0.5.9/debian/control 2021-01-19 15:16:13.000000000 +0000 +++ python-num2words-0.5.10/debian/control 2021-09-14 10:32:39.000000000 +0000 @@ -4,7 +4,7 @@ Maintainer: Debian Python Team Uploaders: Sophie Brun Build-Depends: debhelper-compat (= 12), dh-python, python3-all, python3-setuptools, python3-docopt -Standards-Version: 4.1.4 +Standards-Version: 4.6.0 Homepage: https://github.com/savoirfairelinux/num2words Vcs-Git: https://salsa.debian.org/python-team/packages/python-num2words.git Vcs-Browser: https://salsa.debian.org/python-team/packages/python-num2words diff -Nru python-num2words-0.5.9/debian/patches/Disable-CLI-tests-as-we-don-t-have-python3-delegator-in-D.patch python-num2words-0.5.10/debian/patches/Disable-CLI-tests-as-we-don-t-have-python3-delegator-in-D.patch --- python-num2words-0.5.9/debian/patches/Disable-CLI-tests-as-we-don-t-have-python3-delegator-in-D.patch 2021-01-19 15:16:13.000000000 +0000 +++ python-num2words-0.5.10/debian/patches/Disable-CLI-tests-as-we-don-t-have-python3-delegator-in-D.patch 2021-09-14 10:32:39.000000000 +0000 @@ -8,22 +8,9 @@ 2 files changed, 112 deletions(-) delete mode 100644 tests/test_cli.py -diff --git a/setup.py b/setup.py -index fbc34f7..a830169 100644 ---- a/setup.py -+++ b/setup.py -@@ -75,5 +75,4 @@ setup( - classifiers=CLASSIFIERS, - scripts=['bin/num2words'], - install_requires=["docopt>=0.6.2"], -- tests_require=['delegator.py'], - ) -diff --git a/tests/test_cli.py b/tests/test_cli.py -deleted file mode 100644 -index 484a8dc..0000000 --- a/tests/test_cli.py +++ /dev/null -@@ -1,111 +0,0 @@ +@@ -1,113 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (c) 2003, Taro Ogawa. All Rights Reserved. @@ -48,6 +35,7 @@ -import unittest - -import delegator +- -import num2words - - @@ -113,7 +101,7 @@ - self.assertEqual(output.return_code, 0) - self.assertEqual( - output.out.strip(), -- "one hundred and fifty point zero" +- "one hundred and fifty" - ) - - def test_cli_with_lang(self): @@ -123,7 +111,7 @@ - self.assertEqual(output.return_code, 0) - self.assertEqual( - output.out.strip(), -- "ciento cincuenta punto cero" +- "ciento cincuenta" - ) - - def test_cli_with_lang_to(self): @@ -132,6 +120,15 @@ - output = self.cli.run_cmd(150.55, '--lang', 'es', '--to', 'currency') - self.assertEqual(output.return_code, 0) - self.assertEqual( -- output.out.strip(), -- "ciento cincuenta euros con cincuenta y cinco centimos" +- (output.out.decode('utf-8') if hasattr(output.out, 'decode') else +- output.out).strip(), +- "ciento cincuenta euros con cincuenta y cinco céntimos" - ) +--- a/setup.py ++++ b/setup.py +@@ -75,5 +75,4 @@ + classifiers=CLASSIFIERS, + scripts=['bin/num2words'], + install_requires=["docopt>=0.6.2"], +- tests_require=['delegator.py'], + ) diff -Nru python-num2words-0.5.9/debian/watch python-num2words-0.5.10/debian/watch --- python-num2words-0.5.9/debian/watch 2021-01-19 15:16:13.000000000 +0000 +++ python-num2words-0.5.10/debian/watch 2021-09-14 10:31:14.000000000 +0000 @@ -1,3 +1,3 @@ version=4 -opts="filenamemangle=s/.*\/(\d.*)\.tar\.gz/python-num2words-$1.tar.gz/" \ -https://github.com/savoirfairelinux/num2words/tags .*/(\d.*)\.tar\.gz +opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/python-num2words-$1\.tar\.gz/ \ +https://github.com/savoirfairelinux/num2words/tags .*/v?(\d.*)\.tar\.gz diff -Nru python-num2words-0.5.9/num2words/base.py python-num2words-0.5.10/num2words/base.py --- python-num2words-0.5.9/num2words/base.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/base.py 2019-05-12 15:48:38.000000000 +0000 @@ -97,6 +97,9 @@ return '%s ' % self.negword, num_str[1:] return '', num_str + def str_to_number(self, value): + return Decimal(value) + def to_cardinal(self, value): try: assert int(value) == value @@ -260,14 +263,14 @@ def _cents_terse(self, number, currency): return "%02d" % number - def to_currency(self, val, currency='EUR', cents=True, seperator=',', + def to_currency(self, val, currency='EUR', cents=True, separator=',', adjective=False): """ Args: val: Numeric value currency (str): Currency code cents (bool): Verbose cents - seperator (str): Cent seperator + separator (str): Cent separator adjective (bool): Prefix currency name with adjective Returns: str: Formatted string @@ -294,7 +297,7 @@ minus_str, self.to_cardinal(left), self.pluralize(left, cr1), - seperator, + separator, cents_str, self.pluralize(right, cr2) ) diff -Nru python-num2words-0.5.9/num2words/__init__.py python-num2words-0.5.10/num2words/__init__.py --- python-num2words-0.5.9/num2words/__init__.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/__init__.py 2019-05-12 15:48:38.000000000 +0000 @@ -17,40 +17,12 @@ from __future__ import unicode_literals -from . import lang_AR -from . import lang_CZ -from . import lang_EN -from . import lang_EN_IN -from . import lang_FR -from . import lang_FR_CH -from . import lang_FR_BE -from . import lang_FR_DZ -from . import lang_DE -from . import lang_ES -from . import lang_FI -from . import lang_LT -from . import lang_LV -from . import lang_PL -from . import lang_RO -from . import lang_RU -from . import lang_ID -from . import lang_JA -from . import lang_NO -from . import lang_DK -from . import lang_PT -from . import lang_PT_BR -from . import lang_HE -from . import lang_IT -from . import lang_ES_VE -from . import lang_ES_CO -from . import lang_VI -from . import lang_TR -from . import lang_NL -from . import lang_UK -from . import lang_SL -from . import lang_SR -from . import lang_TH -from . import lang_KO +from . import (lang_AR, lang_CZ, lang_DE, lang_DK, lang_EN, lang_EN_IN, + lang_ES, lang_ES_CO, lang_ES_VE, lang_FI, lang_FR, lang_FR_BE, + lang_FR_CH, lang_FR_DZ, lang_HE, lang_ID, lang_IT, lang_JA, + lang_KN, lang_KO, lang_LT, lang_LV, lang_NL, lang_NO, lang_PL, + lang_PT, lang_PT_BR, lang_RO, lang_RU, lang_SL, lang_SR, + lang_TH, lang_TR, lang_UK, lang_VI) CONVERTER_CLASSES = { 'ar': lang_AR.Num2Word_AR(), @@ -68,6 +40,7 @@ 'es_VE': lang_ES_VE.Num2Word_ES_VE(), 'id': lang_ID.Num2Word_ID(), 'ja': lang_JA.Num2Word_JA(), + 'kn': lang_KN.Num2Word_KN(), 'ko': lang_KO.Num2Word_KO(), 'lt': lang_LT.Num2Word_LT(), 'lv': lang_LV.Num2Word_LV(), @@ -101,6 +74,10 @@ if lang not in CONVERTER_CLASSES: raise NotImplementedError() converter = CONVERTER_CLASSES[lang] + + if isinstance(number, str): + number = converter.str_to_number(number) + # backwards compatible if ordinal: return converter.to_ordinal(number) diff -Nru python-num2words-0.5.9/num2words/lang_AR.py python-num2words-0.5.10/num2words/lang_AR.py --- python-num2words-0.5.9/num2words/lang_AR.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_AR.py 2019-05-12 15:48:38.000000000 +0000 @@ -188,11 +188,11 @@ ones = tens % 10 tens = (tens / 10) - 2 if ones > 0: - if ret_val is not "" and tens < 4: + if ret_val != "" and tens < 4: ret_val += " و " ret_val += self.digit_feminine_status(ones, group_level) - if ret_val is not "" and ones != 0: + if ret_val != "" and ones != 0: ret_val += " و " ret_val += self.arabicTens[int(tens)] @@ -226,9 +226,9 @@ self.process_arabic_group(number_to_process, group, Decimal(floor(temp_number))) - if group_description is not '': + if group_description != '': if group > 0: - if ret_val is not "": + if ret_val != "": ret_val = "{} و {}".format("", ret_val) if number_to_process != 2: if number_to_process % 100 != 1: @@ -236,7 +236,7 @@ ret_val = "{} {}".format( self.arabicPluralGroups[group], ret_val) else: - if ret_val is not "": + if ret_val != "": ret_val = "{} {}".format( self.arabicAppendedGroup[group], ret_val) @@ -250,7 +250,7 @@ ret_val = "{} {}".format(group_description, ret_val) group += 1 formatted_number = "" - if self.arabicPrefixText is not "": + if self.arabicPrefixText != "": formatted_number += "{} ".format(self.arabicPrefixText) formatted_number += ret_val if self.integer_value != 0: @@ -288,7 +288,7 @@ elif 11 <= remaining100 <= 99: formatted_number += self.currency_subunit[3] - if self.arabicSuffixText is not "": + if self.arabicSuffixText != "": formatted_number += " {}".format(self.arabicSuffixText) return formatted_number @@ -299,10 +299,10 @@ return number def set_currency_prefer(self, currency): - if currency is 'EGP': + if currency == 'EGP': self.currency_unit = CURRENCY_EGP[0] self.currency_subunit = CURRENCY_EGP[1] - elif currency is 'KWD': + elif currency == 'KWD': self.currency_unit = CURRENCY_KWD[0] self.currency_subunit = CURRENCY_KWD[1] else: diff -Nru python-num2words-0.5.9/num2words/lang_DE.py python-num2words-0.5.10/num2words/lang_DE.py --- python-num2words-0.5.9/num2words/lang_DE.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_DE.py 2019-05-12 15:48:38.000000000 +0000 @@ -17,10 +17,20 @@ from __future__ import print_function, unicode_literals +import re + from .lang_EU import Num2Word_EU class Num2Word_DE(Num2Word_EU): + CURRENCY_FORMS = { + 'EUR': (('Euro', 'Euro'), ('Cent', 'Cent')), + 'GBP': (('Pfund', 'Pfund'), ('Penny', 'Pence')), + 'USD': (('Dollar', 'Dollar'), ('Cent', 'Cent')), + 'CNY': (('Yuan', 'Yuan'), ('Jiao', 'Fen')), + 'DEM': (('Mark', 'Mark'), ('Pfennig', 'Pfennig')), + } + GIGA_SUFFIX = "illiarde" MEGA_SUFFIX = "illion" @@ -45,7 +55,7 @@ self.errmsg_toobig = "Die Zahl %s muss kleiner als %s sein." self.exclude_title = [] - lows = ["non", "okt", "sept", "sext", "quint", "quadr", "tr", "b", "m"] + lows = ["Non", "Okt", "Sept", "Sext", "Quint", "Quadr", "Tr", "B", "M"] units = ["", "un", "duo", "tre", "quattuor", "quin", "sex", "sept", "okto", "novem"] tens = ["dez", "vigint", "trigint", "quadragint", "quinquagint", @@ -107,7 +117,7 @@ def to_ordinal(self, value): self.verify_ordinal(value) - outword = self.to_cardinal(value) + outword = self.to_cardinal(value).lower() for key in self.ords: if outword.endswith(key): outword = outword[:len(outword) - len(key)] + self.ords[key] @@ -118,6 +128,13 @@ # Exception: "hundertste" is usually preferred over "einhundertste" if res == "eintausendste" or res == "einhundertste": res = res.replace("ein", "", 1) + # ... similarly for "millionste" etc. + res = re.sub(r'eine ([a-z]+(illion|illiard)ste)$', + lambda m: m.group(1), res) + # Ordinals involving "Million" etc. are written without a space. + # see https://de.wikipedia.org/wiki/Million#Sprachliches + res = re.sub(r' ([a-z]+(illion|illiard)ste)$', + lambda m: m.group(1), res) return res @@ -125,22 +142,13 @@ self.verify_ordinal(value) return str(value) + "." - def to_currency(self, val, longval=True, old=False): - hightxt = "Euro" - lowtxt = "Cent" - if old: - hightxt = "Mark" - lowtxt = "Pfennig/e" - - cents = int(round(val*100)) - res = self.to_splitnum(cents, hightxt=hightxt, lowtxt=lowtxt, - jointxt="und", longval=longval) - + def to_currency(self, val, currency='EUR', cents=True, separator=' und', + adjective=False): + result = super(Num2Word_DE, self).to_currency( + val, currency=currency, cents=cents, separator=separator, + adjective=adjective) # Handle exception, in german is "ein Euro" and not "eins Euro" - if res.startswith("eins "): - res = res.replace("eins ", "ein ", 1) - - return res + return result.replace("eins ", "ein ") def to_year(self, val, longval=True): if not (val // 100) % 10: diff -Nru python-num2words-0.5.9/num2words/lang_ES.py python-num2words-0.5.10/num2words/lang_ES.py --- python-num2words-0.5.9/num2words/lang_ES.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_ES.py 2019-05-12 15:48:38.000000000 +0000 @@ -22,10 +22,10 @@ class Num2Word_ES(Num2Word_EU): CURRENCY_FORMS = { - 'EUR': (('euro', 'euros'), ('centimo', 'centimos')), - 'ESP': (('peseta', 'pesetas'), ('centimo', 'centimos')), - 'USD': (('dolar', 'dolares'), ('centavo', 'centavos')), - 'PEN': (('sol', 'soles'), ('centimo', 'centimos')), + 'EUR': (('euro', 'euros'), ('céntimo', 'céntimos')), + 'ESP': (('peseta', 'pesetas'), ('céntimo', 'céntimos')), + 'USD': (('dolar', 'dólares'), ('centavo', 'centavos')), + 'PEN': (('sol', 'soles'), ('céntimo', 'céntimos')), } # //CHECK: Is this sufficient?? @@ -168,10 +168,10 @@ self.verify_ordinal(value) return "%s%s" % (value, "º" if self.gender_stem == 'o' else "ª") - def to_currency(self, val, currency='EUR', cents=True, seperator=' con', + def to_currency(self, val, currency='EUR', cents=True, separator=' con', adjective=False): result = super(Num2Word_ES, self).to_currency( - val, currency=currency, cents=cents, seperator=seperator, + val, currency=currency, cents=cents, separator=separator, adjective=adjective) # Handle exception, in spanish is "un euro" and not "uno euro" return result.replace("uno", "un") diff -Nru python-num2words-0.5.9/num2words/lang_EU.py python-num2words-0.5.10/num2words/lang_EU.py --- python-num2words-0.5.9/num2words/lang_EU.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_EU.py 2019-05-12 15:48:38.000000000 +0000 @@ -42,6 +42,7 @@ 'PLN': (('zloty', 'zlotys', 'zlotu'), ('grosz', 'groszy')), 'MXN': (('peso', 'pesos'), GENERIC_CENTS), 'RON': (('leu', 'lei'), ('ban', 'bani')), + 'INR': (('rupee', 'rupees'), ('paisa', 'paise')) } CURRENCY_ADJECTIVES = { @@ -53,6 +54,7 @@ 'NOK': 'Norwegian', 'MXN': 'Mexican', 'RON': 'Romanian', + 'INR': 'Indian', } GIGA_SUFFIX = "illiard" diff -Nru python-num2words-0.5.9/num2words/lang_FI.py python-num2words-0.5.10/num2words/lang_FI.py --- python-num2words-0.5.9/num2words/lang_FI.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_FI.py 2019-05-12 15:48:38.000000000 +0000 @@ -682,10 +682,10 @@ suffix = suffix or " ennen ajanlaskun alkua" return self.to_cardinal(val).replace(" ", "") + suffix - def to_currency(self, val, currency="EUR", cents=True, seperator=" ja", + def to_currency(self, val, currency="EUR", cents=True, separator=" ja", adjective=False): return super(Num2Word_FI, self).to_currency( - val, currency=currency, cents=cents, seperator=seperator, + val, currency=currency, cents=cents, separator=separator, adjective=adjective) def splitnum(self, value, options): diff -Nru python-num2words-0.5.9/num2words/lang_FR_DZ.py python-num2words-0.5.10/num2words/lang_FR_DZ.py --- python-num2words-0.5.9/num2words/lang_FR_DZ.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_FR_DZ.py 2019-05-12 15:48:38.000000000 +0000 @@ -21,8 +21,13 @@ 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", divisor=1, - jointxt=jointxt, longval=longval, cents=cents - ) + CURRENCY_FORMS = { + 'DIN': (('dinard', 'dinards'), ('centime', 'centimes')), + } + + def to_currency(self, val, currency='DIN', cents=True, separator=' et', + adjective=False): + result = super(Num2Word_FR, self).to_currency( + val, currency=currency, cents=cents, separator=separator, + adjective=adjective) + return result diff -Nru python-num2words-0.5.9/num2words/lang_FR.py python-num2words-0.5.10/num2words/lang_FR.py --- python-num2words-0.5.9/num2words/lang_FR.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_FR.py 2019-05-12 15:48:38.000000000 +0000 @@ -21,6 +21,14 @@ class Num2Word_FR(Num2Word_EU): + CURRENCY_FORMS = { + 'EUR': (('euro', 'euros'), ('centime', 'centimes')), + 'USD': (('dollar', 'dollars'), ('cent', 'cents')), + 'FRF': (('franc', 'francs'), ('centime', 'centimes')), + 'GBP': (('livre', 'livres'), ('penny', 'pence')), + 'CNY': (('yuan', 'yuans'), ('fen', 'jiaos')), + } + def setup(self): Num2Word_EU.setup(self) @@ -89,13 +97,12 @@ def to_ordinal_num(self, value): self.verify_ordinal(value) out = str(value) - out += {"1": "er"}.get(out[-1], "me") + out += "er" if value == 1 else "me" return out - def to_currency(self, val, longval=True, old=False): - hightxt = "euro/s" - if old: - hightxt = "franc/s" - cents = int(round(val*100)) - return self.to_splitnum(cents, hightxt=hightxt, lowtxt="centime/s", - divisor=100, jointxt="et", longval=longval) + def to_currency(self, val, currency='EUR', cents=True, separator=' et', + adjective=False): + result = super(Num2Word_FR, self).to_currency( + val, currency=currency, cents=cents, separator=separator, + adjective=adjective) + return result diff -Nru python-num2words-0.5.9/num2words/lang_HE.py python-num2words-0.5.10/num2words/lang_HE.py --- python-num2words-0.5.9/num2words/lang_HE.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_HE.py 2019-05-12 15:48:38.000000000 +0000 @@ -131,7 +131,7 @@ return int2word(int(n)) -def to_currency(n, currency='EUR', cents=True, seperator=','): +def to_currency(n, currency='EUR', cents=True, separator=','): raise NotImplementedError() diff -Nru python-num2words-0.5.9/num2words/lang_IT.py python-num2words-0.5.10/num2words/lang_IT.py --- python-num2words-0.5.9/num2words/lang_IT.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_IT.py 2019-05-12 15:48:38.000000000 +0000 @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (c) 2003, Taro Ogawa. All Rights Reserved. -# Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved. +# Copyright (c) 2018-2019, Filippo Costa. All Rights Reserved. # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public diff -Nru python-num2words-0.5.9/num2words/lang_JA.py python-num2words-0.5.10/num2words/lang_JA.py --- python-num2words-0.5.9/num2words/lang_JA.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_JA.py 2019-05-12 15:48:38.000000000 +0000 @@ -491,7 +491,7 @@ return fmt % (era_name, era_year_words) - def to_currency(self, val, currency="JPY", cents=False, seperator="", + def to_currency(self, val, currency="JPY", cents=False, separator="", adjective=False, reading=False, prefer=None): left, right, is_negative = parse_currency_parts( val, is_int_with_cents=cents) diff -Nru python-num2words-0.5.9/num2words/lang_KN.py python-num2words-0.5.10/num2words/lang_KN.py --- python-num2words-0.5.9/num2words/lang_KN.py 1970-01-01 00:00:00.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_KN.py 2019-05-12 15:48:38.000000000 +0000 @@ -0,0 +1,182 @@ +# -*- encoding: utf-8 -*- +# Copyright (c) 2003, Taro Ogawa. All Rights Reserved. +# Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved. + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA + +from __future__ import unicode_literals + +from .base import Num2Word_Base + + +class Num2Word_KN(Num2Word_Base): + def set_high_numwords(self, high): + for n, word in self.high_numwords: + self.cards[10 ** n] = word + + def setup(self): + self.low_numwords = [ + "ತೊಂಬತ್ತೊಂಬತ್ತು", + "ತೊಂಬತ್ತೆಂಟು", + "ತೊಂಬತ್ತೇಳು", + "ತೊಂಬತ್ತಾರು", + "ತೊಂಬತ್ತೈದು", + "ತೊಂಬತ್ತ ನಾಲ್ಕು", + "ತೊಂಬತ್ತ ಮೂರು", + "ತೊಂಬತ್ತೆರಡು", + "ತೊಂಬತ್ತೊಂದು", + "ತೊಂಬತ್ತು", + "ಎಂಬತ್ತೊಂಬತ್ತು", + "ಎಂಬತ್ತೆಂಟು", + "ಎಂಬತ್ತೇಳು", + "ಎಂಬತ್ತಾರು", + "ಎಂಬತ್ತೈದು", + "ಎಂಬತ್ತ್ ನಾಲ್ಕು", + "ಎಂಬತ್ತ್ ಮೂರು", + "ಎಂಬತ್ತೆರಡು", + "ಎಂಬತ್ತೊಂದು", + "ಎಂಬತ್ತು", + "ಎಪ್ಪತ್ತೊಂಬತ್ತು", + "ಎಪ್ಪತ್ತೆಂಟು", + "ಎಪ್ಪತ್ತೇಳು", + "ಎಪ್ಪತ್ತಾರು", + "ಎಪ್ಪತ್ತೈದು", + "ಎಪ್ಪತ್ತ್ ನಾಲ್ಕು", + "ಎಪ್ಪತ್ತ್ ಮೂರು", + "ಎಪ್ಪತ್ತೆರಡು", + "ಎಪ್ಪತ್ತೊಂದು", + "ಎಪ್ಪತ್ತು", + "ಅರವತ್ತೊಂಬತ್ತು", + "ಅರವತ್ತೆಂಟು", + "ಅರವತ್ತೇಳು", + "ಅರವತ್ತಾರು", + "ಅರವತ್ತೈದು", + "ಅರವತ್ತ್ ನಾಲ್ಕು", + "ಅರವತ್ತ್ ಮೂರು", + "ಅರವತ್ತೆರಡು", + "ಅರವತ್ತೊಂದು", + "ಅರವತ್ತು", + "ಐವತ್ತೊಂಬತ್ತು", + "ಐವತ್ತೆಂಟು", + "ಐವತ್ತೇಳು", + "ಐವತ್ತಾರು", + "ಐವತ್ತೈದು", + "ಐವತ್ತ್ನಾಲ್ಕು", + "ಐವತ್ತಮೂರು", + "ಐವತ್ತೆರಡು", + "ಐವತ್ತೊಂದು", + "ಐವತ್ತು", + "ನಲವತ್ತೊಂಬತ್ತು", + "ನಲವತ್ತೆಂಟು", + "ನಲವತ್ತೇಳು", + "ನಲವತ್ತಾರು", + "ನಲವತ್ತೈದು", + "ನಲವತ್ತ್ ನಾಲ್ಕು", + "ನಲವತ್ತ್ ಮೂರು", + "ನಲವತ್ತ್ ಎರಡು", + "ನಲವತ್ತೊಂದು", + "ನಲವತ್ತು", + "ಮೂವತ್ತ್ ಒಂಬತ್ತು", + "ಮೂವತ್ಎಂಟು", + "ಮೂವತ್ಏಳು", + "ಮೂವತ್ಆರು", + "ಮೂವತ್ತ್ ಐದು", + "ಮೂವತ್ತ್ ನಾಲ್ಕು", + "ಮೂವತ್ತ್ ಮೂರು", + "ಮೂವತ್ತ್ಎರಡು", + "ಮೂವತ್ತ್ಒಂದು", + "ಮೂವತ್ತು", + "ಇಪ್ಪತ್ತ್ಒಂಬತ್ತು", + "ಇಪ್ಪತ್ತ್ಎಂಟು", + "ಇಪ್ಪತ್ತ್ಏಳು", + "ಇಪ್ಪತ್ತ್ಆರು", + "ಇಪ್ಪತ್ತ್ ಐದು", + "ಇಪ್ಪತ್ತ್ ನಾಲ್ಕು", + "ಇಪ್ಪತ್ತ್ ಮೂರು", + "ಇಪ್ಪತ್ತ್ ಎರಡು", + "ಇಪ್ಪತ್ತ್ ಒಂದು", + "ಇಪ್ಪತ್ತು", + "ಹತ್ತೊಂಬತ್ತು", + "ಹದಿನೆಂಟು", + "ಹದಿನೇಳು", + "ಹದಿನಾರು", + "ಹದಿನೈದು", + "ಹದಿನಾಲ್ಕು", + "ಹದಿಮೂರು", + "ಹನ್ನೆರಡು", + "ಹನ್ನೊಂದು", + "ಹತ್ತು", + "ಒಂಬತ್ತು", + "ಎಂಟು", + "ಏಳು", + "ಆರು", + "ಐದು", + "ನಾಲ್ಕು", + "ಮೂರು", + "ಎರಡು", + "ಒಂದು", + "ಸೊನ್ನೆ", + ] + + self.mid_numwords = [(100, "ನೂರು")] + + self.high_numwords = [(7, "ಕೋಟಿ"), (5, "ಒಂದು ಲಕ್ಷ"), (3, "ಸಾವಿರ")] + + self.pointword = "ಬಿಂದು" + + self.modifiers = [ + "್", + "ಾ", + "ಿ", + "ೀ", + "ೀ", + "ು", + "ೂ", + "ೃ", + "ೆ", + "ೇ", + "ೈ", + "ೊ", + "ೋ", + "ೌ", + "ೕ", + ] + + def merge(self, lpair, rpair): + ltext, lnum = lpair + rtext, rnum = rpair + if lnum == 1 and rnum < 100: + return (rtext, rnum) + elif 100 > lnum > rnum: + return ("%s-%s" % (ltext, rtext), lnum + rnum) + elif lnum >= 100 > rnum: + if ltext[-1] in self.modifiers: + return ("%s %s" % (ltext[:-1], rtext), lnum + rnum) + else: + return ("%s %s" % (ltext + "ದ", rtext), lnum + rnum) + elif rnum > lnum: + return ("%s %s" % (ltext, rtext), lnum * rnum) + return ("%s %s" % (ltext, rtext), lnum + rnum) + + def to_ordinal_num(self, value): + self.verify_ordinal(value) + return "%s%s" % (value, self.to_ordinal(value)) + + def to_ordinal(self, value): + self.verify_ordinal(value) + outwords = self.to_cardinal(value) + if outwords[-1] in self.modifiers: + outwords = outwords[:-1] + ordinal_num = outwords + "ನೇ" + return ordinal_num diff -Nru python-num2words-0.5.9/num2words/lang_KO.py python-num2words-0.5.10/num2words/lang_KO.py --- python-num2words-0.5.9/num2words/lang_KO.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_KO.py 2019-05-12 15:48:38.000000000 +0000 @@ -123,7 +123,7 @@ return ("%s년" % valtext if not suffix else "%s %s년" % (suffix, valtext)) - def to_currency(self, val, currency="KRW", cents=False, seperator="", + def to_currency(self, val, currency="KRW", cents=False, separator="", adjective=False): left, right, is_negative = parse_currency_parts( val, is_int_with_cents=cents) diff -Nru python-num2words-0.5.9/num2words/lang_NL.py python-num2words-0.5.10/num2words/lang_NL.py --- python-num2words-0.5.9/num2words/lang_NL.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_NL.py 2019-05-12 15:48:38.000000000 +0000 @@ -22,7 +22,10 @@ class Num2Word_NL(Num2Word_EU): CURRENCY_FORMS = { - 'EUR': (('euro', 'euros'), ('cent', 'cents')), + 'EUR': (('euro', 'euro'), ('cent', 'cent')), + 'GBP': (('pond', 'pond'), ('penny', 'pence')), + 'USD': (('dollar', 'dollar'), ('cent', 'cent')), + 'CNY': (('yuan', 'yuan'), ('jiao', 'fen')), } GIGA_SUFFIX = "iljard" diff -Nru python-num2words-0.5.9/num2words/lang_PL.py python-num2words-0.5.10/num2words/lang_PL.py --- python-num2words-0.5.9/num2words/lang_PL.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_PL.py 2019-05-12 15:48:38.000000000 +0000 @@ -1,165 +1,165 @@ -# -*- coding: utf-8 -*- -# Copyright (c) 2003, Taro Ogawa. All Rights Reserved. -# Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved. - -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, -# MA 02110-1301 USA - -from __future__ import unicode_literals - -from .base import Num2Word_Base -from .utils import get_digits, splitbyx - -ZERO = ('zero',) - -ONES = { - 1: ('jeden',), - 2: ('dwa',), - 3: ('trzy',), - 4: ('cztery',), - 5: ('pięć',), - 6: ('sześć',), - 7: ('siedem',), - 8: ('osiem',), - 9: ('dziewięć',), -} - -TENS = { - 0: ('dziesięć',), - 1: ('jedenaście',), - 2: ('dwanaście',), - 3: ('trzynaście',), - 4: ('czternaście',), - 5: ('piętnaście',), - 6: ('szesnaście',), - 7: ('siedemnaście',), - 8: ('osiemnaście',), - 9: ('dziewiętnaście',), -} - -TWENTIES = { - 2: ('dwadzieścia',), - 3: ('trzydzieści',), - 4: ('czterdzieści',), - 5: ('pięćdziesiąt',), - 6: ('sześćdziesiąt',), - 7: ('siedemdziesiąt',), - 8: ('osiemdziesiąt',), - 9: ('dziewięćdzisiąt',), -} - -HUNDREDS = { - 1: ('sto',), - 2: ('dwieście',), - 3: ('trzysta',), - 4: ('czterysta',), - 5: ('pięćset',), - 6: ('sześćset',), - 7: ('siedemset',), - 8: ('osiemset',), - 9: ('dziewięćset',), -} - -THOUSANDS = { - 1: ('tysiąc', 'tysiące', 'tysięcy'), # 10^3 - 2: ('milion', 'miliony', 'milionów'), # 10^6 - 3: ('miliard', 'miliardy', 'miliardów'), # 10^9 - 4: ('bilion', 'biliony', 'bilionów'), # 10^12 - 5: ('biliard', 'biliardy', 'biliardów'), # 10^15 - 6: ('trylion', 'tryliony', 'trylionów'), # 10^18 - 7: ('tryliard', 'tryliardy', 'tryliardów'), # 10^21 - 8: ('kwadrylion', 'kwadryliony', 'kwadrylionów'), # 10^24 - 9: ('kwadryliard', 'kwadryliardy', 'kwadryliardów'), # 10^27 - 10: ('kwintylion', 'kwintyliony', 'kwintylionów'), # 10^30 - 11: ('kwintyliard', 'kwintyliardy', 'kwintyliardów'), # 10^33 - 12: ('sekstylion', 'sekstyliony', 'sekstylionów'), # 10^36 - 13: ('sekstyliard', 'sekstyliardy', 'sekstyliardów'), # 10^39 - 14: ('septylion', 'septyliony', 'septylionów'), # 10^42 - 15: ('septyliard', 'septyliardy', 'septyliardów'), # 10^45 - 16: ('oktylion', 'oktyliony', 'oktylionów'), # 10^48 - 17: ('oktyliard', 'oktyliardy', 'oktyliardów'), # 10^51 - 18: ('nonylion', 'nonyliony', 'nonylionów'), # 10^54 - 19: ('nonyliard', 'nonyliardy', 'nonyliardów'), # 10^57 - 20: ('decylion', 'decyliony', 'decylionów'), # 10^60 - 21: ('decyliard', 'decyliardy', 'decyliardów'), # 10^63 -} - - -class Num2Word_PL(Num2Word_Base): - CURRENCY_FORMS = { - 'PLN': ( - ('złoty', 'złote', 'złotych'), ('grosz', 'grosze', 'groszy') - ), - 'EUR': ( - ('euro', 'euro', 'euro'), ('cent', 'centy', 'centów') - ), - } - - def setup(self): - self.negword = "minus" - self.pointword = "przecinek" - - def to_cardinal(self, number): - n = str(number).replace(',', '.') - if '.' in n: - left, right = n.split('.') - return u'%s %s %s' % ( - self._int2word(int(left)), - self.pointword, - self._int2word(int(right)) - ) - else: - return self._int2word(int(n)) - - def pluralize(self, n, forms): - if n == 1: - form = 0 - elif 5 > n % 10 > 1 and (n % 100 < 10 or n % 100 > 20): - form = 1 - else: - form = 2 - return forms[form] - - def to_ordinal(self, number): - raise NotImplementedError() - - def _int2word(self, n): - if n == 0: - return ZERO[0] - - words = [] - chunks = list(splitbyx(str(n), 3)) - i = len(chunks) - for x in chunks: - i -= 1 - - if x == 0: - continue - - n1, n2, n3 = get_digits(x) - - if n3 > 0: - words.append(HUNDREDS[n3][0]) - - if n2 > 1: - words.append(TWENTIES[n2][0]) - - if n2 == 1: - words.append(TENS[n1][0]) - elif n1 > 0 and not (i > 0 and x == 1): - words.append(ONES[n1][0]) - - if i > 0: - words.append(self.pluralize(x, THOUSANDS[i])) - - return ' '.join(words) +# -*- coding: utf-8 -*- +# Copyright (c) 2003, Taro Ogawa. All Rights Reserved. +# Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved. + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA + +from __future__ import unicode_literals + +import itertools + +from .base import Num2Word_Base +from .utils import get_digits, splitbyx + +ZERO = ('zero',) + +ONES = { + 1: ('jeden',), + 2: ('dwa',), + 3: ('trzy',), + 4: ('cztery',), + 5: ('pięć',), + 6: ('sześć',), + 7: ('siedem',), + 8: ('osiem',), + 9: ('dziewięć',), +} + +TENS = { + 0: ('dziesięć',), + 1: ('jedenaście',), + 2: ('dwanaście',), + 3: ('trzynaście',), + 4: ('czternaście',), + 5: ('piętnaście',), + 6: ('szesnaście',), + 7: ('siedemnaście',), + 8: ('osiemnaście',), + 9: ('dziewiętnaście',), +} + +TWENTIES = { + 2: ('dwadzieścia',), + 3: ('trzydzieści',), + 4: ('czterdzieści',), + 5: ('pięćdziesiąt',), + 6: ('sześćdziesiąt',), + 7: ('siedemdziesiąt',), + 8: ('osiemdziesiąt',), + 9: ('dziewięćdzisiąt',), +} + +HUNDREDS = { + 1: ('sto',), + 2: ('dwieście',), + 3: ('trzysta',), + 4: ('czterysta',), + 5: ('pięćset',), + 6: ('sześćset',), + 7: ('siedemset',), + 8: ('osiemset',), + 9: ('dziewięćset',), +} + +THOUSANDS = { + 1: ('tysiąc', 'tysiące', 'tysięcy'), # 10^3 +} + +prefixes = ( # 10^(6*x) + "mi", # 10^6 + "bi", # 10^12 + "try", # 10^18 + "kwadry", # 10^24 + "kwinty", # 10^30 + "seksty", # 10^36 + "septy", # 10^42 + "okty", # 10^48 + "nony", # 10^54 + "decy" # 10^60 +) +suffixes = ("lion", "liard") # 10^x or 10^(x+3) + +for idx, (p, s) in enumerate(itertools.product(prefixes, suffixes)): + name = p + s + THOUSANDS[idx+2] = (name, name + 'y', name + 'ów') + + +class Num2Word_PL(Num2Word_Base): + CURRENCY_FORMS = { + 'PLN': ( + ('złoty', 'złote', 'złotych'), ('grosz', 'grosze', 'groszy') + ), + 'EUR': ( + ('euro', 'euro', 'euro'), ('cent', 'centy', 'centów') + ), + } + + def setup(self): + self.negword = "minus" + self.pointword = "przecinek" + + def to_cardinal(self, number): + n = str(number).replace(',', '.') + if '.' in n: + left, right = n.split('.') + return u'%s %s %s' % ( + self._int2word(int(left)), + self.pointword, + self._int2word(int(right)) + ) + else: + return self._int2word(int(n)) + + def pluralize(self, n, forms): + if n == 1: + form = 0 + elif 5 > n % 10 > 1 and (n % 100 < 10 or n % 100 > 20): + form = 1 + else: + form = 2 + return forms[form] + + def to_ordinal(self, number): + raise NotImplementedError() + + def _int2word(self, n): + if n == 0: + return ZERO[0] + + words = [] + chunks = list(splitbyx(str(n), 3)) + i = len(chunks) + for x in chunks: + i -= 1 + + if x == 0: + continue + + n1, n2, n3 = get_digits(x) + + if n3 > 0: + words.append(HUNDREDS[n3][0]) + + if n2 > 1: + words.append(TWENTIES[n2][0]) + + if n2 == 1: + words.append(TENS[n1][0]) + elif n1 > 0 and not (i > 0 and x == 1): + words.append(ONES[n1][0]) + + if i > 0: + words.append(self.pluralize(x, THOUSANDS[i])) + + return ' '.join(words) diff -Nru python-num2words-0.5.9/num2words/lang_PT.py python-num2words-0.5.10/num2words/lang_PT.py --- python-num2words-0.5.9/num2words/lang_PT.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_PT.py 2019-05-12 15:48:38.000000000 +0000 @@ -215,13 +215,13 @@ return self.to_cardinal(abs(val)) + ' antes de Cristo' return self.to_cardinal(val) - def to_currency(self, val, currency='EUR', cents=True, seperator=' e', + def to_currency(self, val, currency='EUR', cents=True, separator=' e', adjective=False): # change negword because base.to_currency() does not need space after backup_negword = self.negword self.negword = self.negword[:-1] result = super(Num2Word_PT, self).to_currency( - val, currency=currency, cents=cents, seperator=seperator, + val, currency=currency, cents=cents, separator=separator, adjective=adjective) # undo the change on negword self.negword = backup_negword diff -Nru python-num2words-0.5.9/num2words/lang_SL.py python-num2words-0.5.10/num2words/lang_SL.py --- python-num2words-0.5.9/num2words/lang_SL.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_SL.py 2019-05-12 15:48:38.000000000 +0000 @@ -22,8 +22,8 @@ class Num2Word_SL(Num2Word_EU): - GIGA_SUFFIX = "iljard" - MEGA_SUFFIX = "iljon" + GIGA_SUFFIX = "ilijard" + MEGA_SUFFIX = "ilijon" def setup(self): super(Num2Word_SL, self).setup() @@ -36,7 +36,7 @@ self.mid_numwords = [(1000, "tisoč"), (900, "devetsto"), (800, "osemsto"), (700, "sedemsto"), - (600, "šesto"), (500, "petsto"), + (600, "šeststo"), (500, "petsto"), (400, "štiristo"), (300, "tristo"), (200, "dvesto"), (100, "sto"), (90, "devetdeset"), (80, "osemdeset"), @@ -57,16 +57,31 @@ "osem": "osm", "sto": "stot", "tisoč": "tisoč", - "miljon": "miljont" + "milijon": "milijont" } self.ordflag = False def merge(self, curr, next): ctext, cnum, ntext, nnum = curr + next - if ctext == "dve" and not self.ordflag: + if ctext.endswith("dve") and self.ordflag and nnum <= 1000000: + ctext = ctext[:len(ctext)-1] + "a" + + if ctext == "dve" and not self.ordflag and nnum < 1000000000: ctext = "dva" + if (ctext.endswith("tri") or ctext.endswith("štiri")) and\ + nnum == 1000000 and not self.ordflag: + if ctext.endswith("štiri"): + ctext = ctext[:-1] + ctext = ctext + "je" + + if cnum >= 20 and cnum < 100 and nnum == 2: + ntext = "dva" + + if ctext.endswith("ena") and nnum >= 1000: + ctext = ctext[0:-1] + if cnum == 1: if nnum < 10**6 or self.ordflag: return next @@ -89,15 +104,28 @@ elif not ntext.endswith("d"): ntext += "i" + elif ctext.endswith("en"): + if ntext.endswith("d") or ntext.endswith("n"): + ntext += "" + + elif ctext.endswith("dve") and ntext.endswith("n"): + ctext = ctext[:-1] + "a" + ntext += "a" + + elif ctext.endswith("je") and ntext.endswith("n"): + ntext += "i" + else: if ntext.endswith("d"): + ntext += "a" + elif ntext.endswith("n"): ntext += "" elif ntext.endswith("d"): ntext += "e" else: ntext += "ov" - if nnum >= 10**2 and self.ordflag is False: + if nnum >= 10**2 and self.ordflag is False and ctext: ctext += " " val = cnum * nnum diff -Nru python-num2words-0.5.9/num2words/lang_SR.py python-num2words-0.5.10/num2words/lang_SR.py --- python-num2words-0.5.9/num2words/lang_SR.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/num2words/lang_SR.py 2019-05-12 15:48:38.000000000 +0000 @@ -173,14 +173,14 @@ return ' '.join(words) - def to_currency(self, val, currency='EUR', cents=True, seperator=',', + def to_currency(self, val, currency='EUR', cents=True, separator=',', adjective=False): """ Args: val: Numeric value currency (str): Currency code cents (bool): Verbose cents - seperator (str): Cent seperator + separator (str): Cent separator adjective (bool): Prefix currency name with adjective Returns: str: Formatted string @@ -210,7 +210,7 @@ minus_str, self.to_cardinal(left, feminine=cr1[-1]), self.pluralize(left, cr1), - seperator, + separator, cents_str, self.pluralize(right, cr2) ) diff -Nru python-num2words-0.5.9/README.rst python-num2words-0.5.10/README.rst --- python-num2words-0.5.9/README.rst 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/README.rst 2019-05-12 15:48:38.000000000 +0000 @@ -95,6 +95,7 @@ * ``id`` (Indonesian) * ``it`` (Italian) * ``ja`` (Japanese) +* ``kn`` (Kannada) * ``ko`` (Korean) * ``lt`` (Lithuanian) * ``lv`` (Latvian) diff -Nru python-num2words-0.5.9/tests/test_cli.py python-num2words-0.5.10/tests/test_cli.py --- python-num2words-0.5.9/tests/test_cli.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_cli.py 2019-05-12 15:48:38.000000000 +0000 @@ -22,6 +22,7 @@ import unittest import delegator + import num2words @@ -87,7 +88,7 @@ self.assertEqual(output.return_code, 0) self.assertEqual( output.out.strip(), - "one hundred and fifty point zero" + "one hundred and fifty" ) def test_cli_with_lang(self): @@ -97,7 +98,7 @@ self.assertEqual(output.return_code, 0) self.assertEqual( output.out.strip(), - "ciento cincuenta punto cero" + "ciento cincuenta" ) def test_cli_with_lang_to(self): @@ -106,6 +107,7 @@ output = self.cli.run_cmd(150.55, '--lang', 'es', '--to', 'currency') self.assertEqual(output.return_code, 0) self.assertEqual( - output.out.strip(), - "ciento cincuenta euros con cincuenta y cinco centimos" + (output.out.decode('utf-8') if hasattr(output.out, 'decode') else + output.out).strip(), + "ciento cincuenta euros con cincuenta y cinco céntimos" ) diff -Nru python-num2words-0.5.9/tests/test_cz.py python-num2words-0.5.10/tests/test_cz.py --- python-num2words-0.5.9/tests/test_cz.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_cz.py 2019-05-12 15:48:38.000000000 +0000 @@ -84,11 +84,11 @@ "tisíc dvěstě třicet čtyři koruny, padesát šest haléřů") self.assertEqual( num2words(101.11, lang='cz', to='currency', currency='EUR', - seperator=' a'), + separator=' a'), "sto jedna euro a jedenáct centů") self.assertEqual( num2words(101.21, lang='cz', to='currency', currency='CZK', - seperator=' a'), + separator=' a'), "sto jedna korun a dvacet jedna haléřů" ) self.assertEqual( @@ -97,7 +97,7 @@ ) self.assertEqual( num2words(123.50, lang='cz', to='currency', currency='CZK', - seperator=' a'), + separator=' a'), "sto dvacet tři koruny a padesát haléřů" ) self.assertEqual( diff -Nru python-num2words-0.5.9/tests/test_de.py python-num2words-0.5.10/tests/test_de.py --- python-num2words-0.5.9/tests/test_de.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_de.py 2019-05-12 15:48:38.000000000 +0000 @@ -21,9 +21,52 @@ from num2words import num2words +TEST_CASES_TO_CURRENCY_EUR = ( + (1.00, 'ein Euro und null Cent'), + (2.01, 'zwei Euro und ein Cent'), + (8.10, 'acht Euro und zehn Cent'), + (12.26, 'zwölf Euro und sechsundzwanzig Cent'), + (21.29, 'einundzwanzig Euro und neunundzwanzig Cent'), + (81.25, 'einundachtzig Euro und fünfundzwanzig Cent'), + (100.00, 'einhundert Euro und null Cent'), +) + +TEST_CASES_TO_CURRENCY_USD = ( + (1.00, 'ein Dollar und null Cent'), + (2.01, 'zwei Dollar und ein Cent'), + (8.10, 'acht Dollar und zehn Cent'), + (12.26, 'zwölf Dollar und sechsundzwanzig Cent'), + (21.29, 'einundzwanzig Dollar und neunundzwanzig Cent'), + (81.25, 'einundachtzig Dollar und fünfundzwanzig Cent'), + (100.00, 'einhundert Dollar und null Cent'), +) + +TEST_CASES_TO_CURRENCY_GBP = ( + (1.00, 'ein Pfund und null Pence'), + (2.01, 'zwei Pfund und ein Penny'), + (8.10, 'acht Pfund und zehn Pence'), + (12.26, 'zwölf Pfund und sechsundzwanzig Pence'), + (21.29, 'einundzwanzig Pfund und neunundzwanzig Pence'), + (81.25, 'einundachtzig Pfund und fünfundzwanzig Pence'), + (100.00, 'einhundert Pfund und null Pence'), +) + +TEST_CASES_TO_CURRENCY_DEM = ( + (1.00, 'ein Mark und null Pfennig'), + (2.01, 'zwei Mark und ein Pfennig'), + (8.10, 'acht Mark und zehn Pfennig'), + (12.26, 'zwölf Mark und sechsundzwanzig Pfennig'), + (21.29, 'einundzwanzig Mark und neunundzwanzig Pfennig'), + (81.25, 'einundachtzig Mark und fünfundzwanzig Pfennig'), + (100.00, 'einhundert Mark und null Pfennig'), +) + class Num2WordsDETest(TestCase): + def test_ordinal_less_than_twenty(self): + self.assertEqual(num2words(0, ordinal=True, lang='de'), "nullte") + self.assertEqual(num2words(1, ordinal=True, lang='de'), "erste") self.assertEqual(num2words(7, ordinal=True, lang='de'), "siebte") self.assertEqual(num2words(8, ordinal=True, lang='de'), "achte") self.assertEqual(num2words(12, ordinal=True, lang='de'), "zwölfte") @@ -45,18 +88,28 @@ num2words(4000, ordinal=True, lang='de'), "viertausendste" ) self.assertEqual( - num2words(2000000, ordinal=True, lang='de'), "zwei millionste" + num2words(1000000, ordinal=True, lang='de'), "millionste" + ) + self.assertEqual( + num2words(2000000, ordinal=True, lang='de'), "zweimillionste" + ) + self.assertEqual( + num2words(1000000000, ordinal=True, lang='de'), "milliardste" ) self.assertEqual( num2words(5000000000, ordinal=True, lang='de'), - "fünf milliardste" + "fünfmilliardste" ) def test_cardinal_at_some_numbers(self): self.assertEqual(num2words(100, lang='de'), "einhundert") - self.assertEqual(num2words(2000000, lang='de'), "zwei millionen") - self.assertEqual(num2words(4000000000, lang='de'), "vier milliarden") - self.assertEqual(num2words(1000000000, lang='de'), "eine milliarde") + self.assertEqual(num2words(1000, lang='de'), "eintausend") + self.assertEqual(num2words(5000, lang='de'), "fünftausend") + self.assertEqual(num2words(10000, lang='de'), "zehntausend") + self.assertEqual(num2words(1000000, lang='de'), "eine Million") + self.assertEqual(num2words(2000000, lang='de'), "zwei Millionen") + self.assertEqual(num2words(4000000000, lang='de'), "vier Milliarden") + self.assertEqual(num2words(1000000000, lang='de'), "eine Milliarde") def test_cardinal_for_decimal_number(self): self.assertEqual( @@ -66,8 +119,8 @@ def test_giant_cardinal_for_merge(self): self.assertEqual( num2words(4500072900000111, lang='de'), - "vier billiarden fünfhundert billionen " + - "zweiundsiebzig milliarden neunhundert millionen einhundertelf" + "vier Billiarden fünfhundert Billionen " + + "zweiundsiebzig Milliarden neunhundert Millionen einhundertelf" ) def test_ordinal_num(self): @@ -80,29 +133,33 @@ def test_ordinal_for_floating_numbers(self): self.assertRaises(TypeError, num2words, 2.453, ordinal=True, lang='de') - def test_currency(self): - self.assertEqual(num2words(1, lang='de', to='currency'), - 'ein Euro') - self.assertEqual(num2words(12, lang='de', to='currency'), - 'zwölf Euro') - self.assertEqual(num2words(12.00, lang='de', to='currency'), - 'zwölf Euro') - self.assertEqual(num2words(100.0, lang='de', to='currency'), - "einhundert Euro") - self.assertEqual(num2words(190, lang='de', to='currency'), - "einhundertneunzig Euro") - self.assertEqual(num2words(1.90, lang='de', to='currency'), - "ein Euro und neunzig Cent") - self.assertEqual(num2words(3.4, lang='de', to='currency'), - "drei Euro und vierzig Cent") - self.assertEqual(num2words(20.18, lang='de', to='currency'), - "zwanzig Euro und achtzehn Cent") - self.assertEqual(num2words(3.04, lang='de', to='currency'), - "drei Euro und vier Cent") - - def test_old_currency(self): - self.assertEqual(num2words(12.00, to='currency', lang='de', old=True), - 'zwölf Mark') + def test_currency_eur(self): + for test in TEST_CASES_TO_CURRENCY_EUR: + self.assertEqual( + num2words(test[0], lang='de', to='currency', currency='EUR'), + test[1] + ) + + def test_currency_usd(self): + for test in TEST_CASES_TO_CURRENCY_USD: + self.assertEqual( + num2words(test[0], lang='de', to='currency', currency='USD'), + test[1] + ) + + def test_currency_dem(self): + for test in TEST_CASES_TO_CURRENCY_DEM: + self.assertEqual( + num2words(test[0], lang='de', to='currency', currency='DEM'), + test[1] + ) + + def test_currency_gbp(self): + for test in TEST_CASES_TO_CURRENCY_GBP: + self.assertEqual( + num2words(test[0], lang='de', to='currency', currency='GBP'), + test[1] + ) def test_year(self): self.assertEqual(num2words(2002, to='year', lang='de'), diff -Nru python-num2words-0.5.9/tests/test_en.py python-num2words-0.5.10/tests/test_en.py --- python-num2words-0.5.9/tests/test_en.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_en.py 2019-05-12 15:48:38.000000000 +0000 @@ -71,54 +71,54 @@ def test_to_currency(self): self.assertEqual( - num2words('38.4', lang='en', to='currency', seperator=' and', + num2words('38.4', lang='en', to='currency', separator=' and', cents=False, currency='USD'), "thirty-eight dollars and 40 cents" ) self.assertEqual( - num2words('0', lang='en', to='currency', seperator=' and', + num2words('0', lang='en', to='currency', separator=' and', cents=False, currency='USD'), "zero dollars and 00 cents" ) self.assertEqual( - num2words('1.01', lang='en', to='currency', seperator=' and', + num2words('1.01', lang='en', to='currency', separator=' and', cents=True, currency='USD'), "one dollar and one cent" ) self.assertEqual( - num2words('4778.00', lang='en', to='currency', seperator=' and', + num2words('4778.00', lang='en', to='currency', separator=' and', cents=True, currency='USD', adjective=True), 'four thousand, seven hundred and seventy-eight US dollars' ' and zero cents') self.assertEqual( - num2words('4778.00', lang='en', to='currency', seperator=' and', + num2words('4778.00', lang='en', to='currency', separator=' and', cents=True, currency='USD'), 'four thousand, seven hundred and seventy-eight dollars and' ' zero cents') self.assertEqual( - num2words('1.1', lang='en', to='currency', seperator=' and', + num2words('1.1', lang='en', to='currency', separator=' and', cents=True, currency='MXN'), "one peso and ten cents" ) self.assertEqual( - num2words('158.3', lang='en', to='currency', seperator=' and', + num2words('158.3', lang='en', to='currency', separator=' and', cents=True, currency='MXN'), "one hundred and fifty-eight pesos and thirty cents" ) self.assertEqual( - num2words('2000.00', lang='en', to='currency', seperator=' and', + num2words('2000.00', lang='en', to='currency', separator=' and', cents=True, currency='MXN'), "two thousand pesos and zero cents" ) self.assertEqual( - num2words('4.01', lang='en', to='currency', seperator=' and', + num2words('4.01', lang='en', to='currency', separator=' and', cents=True, currency='MXN'), "four pesos and one cent" ) diff -Nru python-num2words-0.5.9/tests/test_es.py python-num2words-0.5.10/tests/test_es.py --- python-num2words-0.5.9/tests/test_es.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_es.py 2019-05-12 15:48:38.000000000 +0000 @@ -112,47 +112,47 @@ ) TEST_CASES_TO_CURRENCY = ( - (1.00, 'un euro con cero centimos'), - (2.00, 'dos euros con cero centimos'), - (8.00, 'ocho euros con cero centimos'), - (12.00, 'doce euros con cero centimos'), - (21.00, 'veintiun euros con cero centimos'), - (81.25, 'ochenta y un euros con veinticinco centimos'), - (350.90, 'trescientos cincuenta euros con noventa centimos'), - (100.00, 'cien euros con cero centimos'), + (1.00, 'un euro con cero céntimos'), + (2.00, 'dos euros con cero céntimos'), + (8.00, 'ocho euros con cero céntimos'), + (12.00, 'doce euros con cero céntimos'), + (21.00, 'veintiun euros con cero céntimos'), + (81.25, 'ochenta y un euros con veinticinco céntimos'), + (350.90, 'trescientos cincuenta euros con noventa céntimos'), + (100.00, 'cien euros con cero céntimos'), ) TEST_CASES_TO_CURRENCY_ESP = ( - (1.00, 'un peseta con cero centimos'), - (2.00, 'dos pesetas con cero centimos'), - (8.00, 'ocho pesetas con cero centimos'), - (12.00, 'doce pesetas con cero centimos'), - (21.00, 'veintiun pesetas con cero centimos'), - (81.25, 'ochenta y un pesetas con veinticinco centimos'), - (350.90, 'trescientos cincuenta pesetas con noventa centimos'), - (100.00, 'cien pesetas con cero centimos'), + (1.00, 'un peseta con cero céntimos'), + (2.00, 'dos pesetas con cero céntimos'), + (8.00, 'ocho pesetas con cero céntimos'), + (12.00, 'doce pesetas con cero céntimos'), + (21.00, 'veintiun pesetas con cero céntimos'), + (81.25, 'ochenta y un pesetas con veinticinco céntimos'), + (350.90, 'trescientos cincuenta pesetas con noventa céntimos'), + (100.00, 'cien pesetas con cero céntimos'), ) TEST_CASES_TO_CURRENCY_USD = ( (1.00, 'un dolar con cero centavos'), - (2.00, 'dos dolares con cero centavos'), - (8.00, 'ocho dolares con cero centavos'), - (12.00, 'doce dolares con cero centavos'), - (21.00, 'veintiun dolares con cero centavos'), - (81.25, 'ochenta y un dolares con veinticinco centavos'), - (350.90, 'trescientos cincuenta dolares con noventa centavos'), - (100.00, 'cien dolares con cero centavos'), + (2.00, 'dos dólares con cero centavos'), + (8.00, 'ocho dólares con cero centavos'), + (12.00, 'doce dólares con cero centavos'), + (21.00, 'veintiun dólares con cero centavos'), + (81.25, 'ochenta y un dólares con veinticinco centavos'), + (350.90, 'trescientos cincuenta dólares con noventa centavos'), + (100.00, 'cien dólares con cero centavos'), ) TEST_CASES_TO_CURRENCY_PEN = ( - (1.00, 'un sol con cero centimos'), - (2.00, 'dos soles con cero centimos'), - (8.00, 'ocho soles con cero centimos'), - (12.00, 'doce soles con cero centimos'), - (21.00, 'veintiun soles con cero centimos'), - (81.25, 'ochenta y un soles con veinticinco centimos'), - (350.90, 'trescientos cincuenta soles con noventa centimos'), - (100.00, 'cien soles con cero centimos'), + (1.00, 'un sol con cero céntimos'), + (2.00, 'dos soles con cero céntimos'), + (8.00, 'ocho soles con cero céntimos'), + (12.00, 'doce soles con cero céntimos'), + (21.00, 'veintiun soles con cero céntimos'), + (81.25, 'ochenta y un soles con veinticinco céntimos'), + (350.90, 'trescientos cincuenta soles con noventa céntimos'), + (100.00, 'cien soles con cero céntimos'), ) diff -Nru python-num2words-0.5.9/tests/test_fr_be.py python-num2words-0.5.10/tests/test_fr_be.py --- python-num2words-0.5.9/tests/test_fr_be.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_fr_be.py 2019-05-12 15:48:38.000000000 +0000 @@ -54,24 +54,24 @@ (1000000000000000000, 'un trillionsième') # over 1e18 is not supported ) -TEST_CASES_TO_CURRENCY = ( - (1, 'un euro'), - (2, 'deux euros'), - (8, 'huit euros'), - (12, 'douze euros'), - (21, 'vingt et un euros'), +TEST_CASES_TO_CURRENCY_EUR = ( + (1.00, 'un euro et zéro centimes'), + (2.01, 'deux euros et un centime'), + (8.10, 'huit euros et dix centimes'), + (12.26, 'douze euros et vingt-six centimes'), + (21.29, 'vingt et un euros et vingt-neuf centimes'), (81.25, 'quatre-vingt et un euros et vingt-cinq centimes'), - (100, 'cent euros'), + (100.00, 'cent euros et zéro centimes'), ) -TEST_CASES_TO_CURRENCY_OLD = ( - (1, 'un franc'), - (2, 'deux francs'), - (8, 'huit francs'), - (12, 'douze francs'), - (21, 'vingt et un francs'), +TEST_CASES_TO_CURRENCY_FRF = ( + (1.00, 'un franc et zéro centimes'), + (2.01, 'deux francs et un centime'), + (8.10, 'huit francs et dix centimes'), + (12.27, 'douze francs et vingt-sept centimes'), + (21.29, 'vingt et un francs et vingt-neuf centimes'), (81.25, 'quatre-vingt et un francs et vingt-cinq centimes'), - (100, 'cent francs'), + (100.00, 'cent francs et zéro centimes'), ) # Lang to execute current test @@ -114,16 +114,16 @@ test[1] ) - def test_currency(self): - for test in TEST_CASES_TO_CURRENCY: + def test_currency_eur(self): + for test in TEST_CASES_TO_CURRENCY_EUR: self.assertEqual( num2words(test[0], lang=LANG, to='currency'), test[1] ) - def test_currency_old(self): - for test in TEST_CASES_TO_CURRENCY_OLD: + def test_currency_frf(self): + for test in TEST_CASES_TO_CURRENCY_FRF: self.assertEqual( - num2words(test[0], lang=LANG, to='currency', old=True), + num2words(test[0], lang=LANG, to='currency', currency='FRF'), test[1] ) diff -Nru python-num2words-0.5.9/tests/test_fr_ch.py python-num2words-0.5.10/tests/test_fr_ch.py --- python-num2words-0.5.9/tests/test_fr_ch.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_fr_ch.py 2019-05-12 15:48:38.000000000 +0000 @@ -55,24 +55,24 @@ (1000000000000000000, 'un trillionsième') # over 1e18 is not supported ) -TEST_CASES_TO_CURRENCY = ( - (1, 'un euro'), - (2, 'deux euros'), - (8, 'huit euros'), - (12, 'douze euros'), - (21, 'vingt et un euros'), +TEST_CASES_TO_CURRENCY_EUR = ( + (1.00, 'un euro et zéro centimes'), + (2.01, 'deux euros et un centime'), + (8.10, 'huit euros et dix centimes'), + (12.26, 'douze euros et vingt-six centimes'), + (21.29, 'vingt et un euros et vingt-neuf centimes'), (81.25, 'huitante et un euros et vingt-cinq centimes'), - (100, 'cent euros'), + (100.00, 'cent euros et zéro centimes'), ) -TEST_CASES_TO_CURRENCY_OLD = ( - (1, 'un franc'), - (2, 'deux francs'), - (8, 'huit francs'), - (12, 'douze francs'), - (21, 'vingt et un francs'), +TEST_CASES_TO_CURRENCY_FRF = ( + (1.00, 'un franc et zéro centimes'), + (2.01, 'deux francs et un centime'), + (8.10, 'huit francs et dix centimes'), + (12.27, 'douze francs et vingt-sept centimes'), + (21.29, 'vingt et un francs et vingt-neuf centimes'), (81.25, 'huitante et un francs et vingt-cinq centimes'), - (100, 'cent francs'), + (100.00, 'cent francs et zéro centimes'), ) @@ -111,16 +111,17 @@ test[1] ) - def test_currency(self): - for test in TEST_CASES_TO_CURRENCY: + def test_currency_eur(self): + for test in TEST_CASES_TO_CURRENCY_EUR: self.assertEqual( num2words(test[0], lang='fr_CH', to='currency'), test[1] ) - def test_currency_old(self): - for test in TEST_CASES_TO_CURRENCY_OLD: + def test_currency_frf(self): + for test in TEST_CASES_TO_CURRENCY_FRF: self.assertEqual( - num2words(test[0], lang='fr_CH', to='currency', old=True), + num2words(test[0], lang='fr_CH', to='currency', + currency='FRF'), test[1] ) diff -Nru python-num2words-0.5.9/tests/test_fr_dz.py python-num2words-0.5.10/tests/test_fr_dz.py --- python-num2words-0.5.9/tests/test_fr_dz.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_fr_dz.py 2019-05-12 15:48:38.000000000 +0000 @@ -29,7 +29,7 @@ (8, 'huit dinards'), (12, 'douze dinards'), (21, 'vingt et un dinards'), - (81.25, 'quatre-vingt-un dinards virgule vingt-cinq centimes'), + (81.25, 'quatre-vingt-un dinards et vingt-cinq centimes'), (100, 'cent dinards'), ) @@ -38,11 +38,11 @@ def test_currency(self): self.assertEqual( num2words(1234.12, lang='fr_DZ', to='currency'), - "mille deux cent trente-quatre dinards virgule douze centimes" + "mille deux cent trente-quatre dinards et douze centimes" ) self.assertEqual( num2words(45689.89, lang='fr_DZ', to='currency'), - "quarante-cinq mille six cent quatre-vingt-neuf dinards virgule " + "quarante-cinq mille six cent quatre-vingt-neuf dinards et " "quatre-vingt-neuf centimes" ) diff -Nru python-num2words-0.5.9/tests/test_fr.py python-num2words-0.5.10/tests/test_fr.py --- python-num2words-0.5.9/tests/test_fr.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_fr.py 2019-05-12 15:48:38.000000000 +0000 @@ -107,34 +107,45 @@ TEST_CASES_ORDINAL_NUM = ( (1, '1er'), (8, '8me'), + (11, '11me'), (12, '12me'), (14, '14me'), + (21, '21me'), (28, '28me'), (100, '100me'), + (101, '101me'), (1000, '1000me'), (1000000, '1000000me') ) -TEST_CASES_TO_CURRENCY = ( - (1, 'un euro'), - (2, 'deux euros'), - (8, 'huit euros'), - (12, 'douze euros'), - (21, 'vingt et un euros'), +TEST_CASES_TO_CURRENCY_EUR = ( + (1.00, 'un euro et zéro centimes'), + (2.01, 'deux euros et un centime'), + (8.10, 'huit euros et dix centimes'), + (12.26, 'douze euros et vingt-six centimes'), + (21.29, 'vingt et un euros et vingt-neuf centimes'), (81.25, 'quatre-vingt-un euros et vingt-cinq centimes'), - (81.2, 'quatre-vingt-un euros et vingt centimes'), - (100, 'cent euros'), + (100.00, 'cent euros et zéro centimes'), ) -TEST_CASES_TO_CURRENCY_OLD = ( - (1, 'un franc'), - (2, 'deux francs'), - (8, 'huit francs'), - (12, 'douze francs'), - (21, 'vingt et un francs'), +TEST_CASES_TO_CURRENCY_FRF = ( + (1.00, 'un franc et zéro centimes'), + (2.01, 'deux francs et un centime'), + (8.10, 'huit francs et dix centimes'), + (12.27, 'douze francs et vingt-sept centimes'), + (21.29, 'vingt et un francs et vingt-neuf centimes'), (81.25, 'quatre-vingt-un francs et vingt-cinq centimes'), - (81.2, 'quatre-vingt-un francs et vingt centimes'), - (100, 'cent francs'), + (100.00, 'cent francs et zéro centimes'), +) + +TEST_CASES_TO_CURRENCY_USD = ( + (1.00, 'un dollar et zéro cents'), + (2.01, 'deux dollars et un cent'), + (8.10, 'huit dollars et dix cents'), + (12.26, 'douze dollars et vingt-six cents'), + (21.29, 'vingt et un dollars et vingt-neuf cents'), + (81.25, 'quatre-vingt-un dollars et vingt-cinq cents'), + (100.00, 'cent dollars et zéro cents'), ) @@ -172,16 +183,23 @@ test[1] ) - def test_currency(self): - for test in TEST_CASES_TO_CURRENCY: + def test_currency_eur(self): + for test in TEST_CASES_TO_CURRENCY_EUR: + self.assertEqual( + num2words(test[0], lang='fr', to='currency', currency='EUR'), + test[1] + ) + + def test_currency_frf(self): + for test in TEST_CASES_TO_CURRENCY_FRF: self.assertEqual( - num2words(test[0], lang='fr', to='currency'), + num2words(test[0], lang='fr', to='currency', currency='FRF'), test[1] ) - def test_currency_old(self): - for test in TEST_CASES_TO_CURRENCY_OLD: + def test_currency_usd(self): + for test in TEST_CASES_TO_CURRENCY_USD: self.assertEqual( - num2words(test[0], lang='fr', to='currency', old=True), + num2words(test[0], lang='fr', to='currency', currency='USD'), test[1] ) diff -Nru python-num2words-0.5.9/tests/test_kn.py python-num2words-0.5.10/tests/test_kn.py --- python-num2words-0.5.9/tests/test_kn.py 1970-01-01 00:00:00.000000000 +0000 +++ python-num2words-0.5.10/tests/test_kn.py 2019-05-12 15:48:38.000000000 +0000 @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +# Copyright (c) 2003, Taro Ogawa. All Rights Reserved. +# Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved. + +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA + + +from unittest import TestCase + +from num2words import num2words + + +class Num2WordsKNTest(TestCase): + def test_numbers(self): + self.assertEqual(num2words(42, lang="kn"), u"ನಲವತ್ತ್ ಎರಡು") + self.assertEqual(num2words(893, lang="kn"), u"ಎಂಟು ನೂರ ತೊಂಬತ್ತ ಮೂರು") + self.assertEqual( + num2words(1729, lang="kn"), u"ಒಂದು ಸಾವಿರ ಏಳು ನೂರ ಇಪ್ಪತ್ತ್ಒಂಬತ್ತು" + ) + self.assertEqual(num2words(123, lang="kn"), u"ಒಂದು ನೂರ ಇಪ್ಪತ್ತ್ ಮೂರು") + self.assertEqual(num2words(32211, lang="kn"), + u"ಮೂವತ್ತ್ಎರಡು ಸಾವಿರ ಎರಡು ನೂರ ಹನ್ನೊಂದು") + + def test_cardinal_for_float_number(self): + self.assertEqual(num2words(3.14, lang="kn"), u"ಮೂರು ಬಿಂದು ಒಂದು ನಾಲ್ಕು") + self.assertEqual(num2words(1.61803, lang="kn"), + u"ಒಂದು ಬಿಂದು ಆರು ಒಂದು ಎಂಟು ಸೊನ್ನೆ ಮೂರು") + + def test_ordinal(self): + self.assertEqual( + num2words(1, lang='kn', to='ordinal'), + u'ಒಂದನೇ' + ) + self.assertEqual( + num2words(22, lang='kn', to='ordinal'), + u'ಇಪ್ಪತ್ತ್ ಎರಡನೇ' + ) + self.assertEqual( + num2words(12, lang='kn', to='ordinal'), + u'ಹನ್ನೆರಡನೇ' + ) + self.assertEqual( + num2words(130, lang='kn', to='ordinal'), + u'ಒಂದು ನೂರ ಮೂವತ್ತನೇ' + ) + self.assertEqual( + num2words(1003, lang='kn', to='ordinal'), + u'ಒಂದು ಸಾವಿರದ ಮೂರನೇ' + ) + + def test_ordinal_num(self): + self.assertEqual(num2words(2, lang="kn", ordinal=True), u"ಎರಡನೇ") + self.assertEqual(num2words(5, lang="kn", ordinal=True), u"ಐದನೇ") + self.assertEqual(num2words(16, lang="kn", ordinal=True), u"ಹದಿನಾರನೇ") + self.assertEqual(num2words(113, lang="kn", ordinal=True), + u"ಒಂದು ನೂರ ಹದಿಮೂರನೇ") diff -Nru python-num2words-0.5.9/tests/test_lv.py python-num2words-0.5.10/tests/test_lv.py --- python-num2words-0.5.9/tests/test_lv.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_lv.py 2019-05-12 15:48:38.000000000 +0000 @@ -106,12 +106,12 @@ ) self.assertEqual( - num2words(10111, lang='lv', to='currency', seperator=' un', + num2words(10111, lang='lv', to='currency', separator=' un', currency='EUR'), "simtu viens eiro un vienpadsmit centi" ) self.assertEqual( - num2words(10121, lang='lv', to='currency', seperator=' un', + num2words(10121, lang='lv', to='currency', separator=' un', currency='LVL'), "simtu viens lats un divdesmit viens santīms" ) @@ -122,26 +122,26 @@ " 85 centi" ) self.assertEqual( - num2words('38.4', lang='lv', to='currency', seperator=' un', + num2words('38.4', lang='lv', to='currency', separator=' un', cents=False, currency='EUR'), "trīsdesmit astoņi eiro un 40 centi" ) # EUR legal form self.assertEqual( - num2words('38.4', lang='lv', to='currency', seperator=' un', + num2words('38.4', lang='lv', to='currency', separator=' un', cents=False, currency='EUR_LEGAL'), "trīsdesmit astoņi euro un 40 centi" ) self.assertEqual( - num2words('38.4', lang='lv', to='currency', seperator=' un', + num2words('38.4', lang='lv', to='currency', separator=' un', cents=False, currency='USD', adjective=False), "trīsdesmit astoņi dolāri un 40 centi" ) self.assertEqual( - num2words('38.4', lang='lv', to='currency', seperator=' un', + num2words('38.4', lang='lv', to='currency', separator=' un', cents=False, currency='USD', adjective=True), "trīsdesmit astoņi ASV dolāri un 40 centi" ) diff -Nru python-num2words-0.5.9/tests/test_nl.py python-num2words-0.5.10/tests/test_nl.py --- python-num2words-0.5.9/tests/test_nl.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_nl.py 2019-05-12 15:48:38.000000000 +0000 @@ -67,29 +67,52 @@ def test_ordinal_for_floating_numbers(self): self.assertRaises(TypeError, num2words, 2.453, ordinal=True, lang='nl') - def test_to_currency(self): + def test_to_currency_eur(self): self.assertEqual( - num2words('38.4', lang='nl', to='currency', seperator=' en', + num2words('38.4', lang='nl', to='currency', separator=' en', cents=False, currency='EUR'), "achtendertig euro en 40 cent" ) self.assertEqual( - num2words('0', lang='nl', to='currency', seperator=' en', + num2words('0', lang='nl', to='currency', separator=' en', cents=False, currency='EUR'), "nul euro en 00 cent" ) self.assertEqual( - num2words('1.01', lang='nl', to='currency', seperator=' en', + num2words('1.01', lang='nl', to='currency', separator=' en', cents=True, currency='EUR'), "één euro en één cent" ) self.assertEqual( - num2words('4778.00', lang='nl', to='currency', seperator=' en', + num2words('4778.00', lang='nl', to='currency', separator=' en', cents=True, currency='EUR'), 'vierduizendzevenhonderdachtenzeventig euro en nul cent') + def test_to_currency_usd(self): + self.assertEqual( + num2words('38.4', lang='nl', to='currency', separator=' en', + cents=False, currency='USD'), + "achtendertig dollar en 40 cent" + ) + self.assertEqual( + num2words('0', lang='nl', to='currency', separator=' en', + cents=False, currency='USD'), + "nul dollar en 00 cent" + ) + + self.assertEqual( + num2words('1.01', lang='nl', to='currency', separator=' en', + cents=True, currency='USD'), + "één dollar en één cent" + ) + + self.assertEqual( + num2words('4778.00', lang='nl', to='currency', separator=' en', + cents=True, currency='USD'), + 'vierduizendzevenhonderdachtenzeventig dollar en nul cent') + def test_pluralize(self): n = Num2Word_NL() # euros always singular diff -Nru python-num2words-0.5.9/tests/test_pl.py python-num2words-0.5.10/tests/test_pl.py --- python-num2words-0.5.9/tests/test_pl.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_pl.py 2019-05-12 15:48:38.000000000 +0000 @@ -106,12 +106,12 @@ ) self.assertEqual( num2words(10111, lang='pl', to='currency', currency='EUR', - seperator=' i'), + separator=' i'), "sto jeden euro i jedenaście centów" ) self.assertEqual( num2words(10121, lang='pl', to='currency', currency='PLN', - seperator=' i'), + separator=' i'), "sto jeden złotych i dwadzieścia jeden groszy" ) self.assertEqual( @@ -120,7 +120,7 @@ ) self.assertEqual( num2words(123.50, lang='pl', to='currency', currency='PLN', - seperator=' i'), + separator=' i'), "sto dwadzieścia trzy złote i pięćdziesiąt groszy" ) self.assertEqual( diff -Nru python-num2words-0.5.9/tests/test_ru.py python-num2words-0.5.10/tests/test_ru.py --- python-num2words-0.5.9/tests/test_ru.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_ru.py 2019-05-12 15:48:38.000000000 +0000 @@ -170,22 +170,22 @@ ) self.assertEqual( num2words(10111, lang='ru', to='currency', currency='EUR', - seperator=' и'), + separator=' и'), 'сто один евро и одиннадцать центов' ) self.assertEqual( num2words(10121, lang='ru', to='currency', currency='RUB', - seperator=' и'), + separator=' и'), 'сто один рубль и двадцать одна копейка' ) self.assertEqual( num2words(10122, lang='ru', to='currency', currency='RUB', - seperator=' и'), + separator=' и'), 'сто один рубль и двадцать две копейки' ) self.assertEqual( num2words(10121, lang='ru', to='currency', currency='EUR', - seperator=' и'), + separator=' и'), 'сто один евро и двадцать один цент' ) self.assertEqual( @@ -194,7 +194,7 @@ 'минус двенадцать тысяч пятьсот девятнадцать евро, 85 центов' ) self.assertEqual( - num2words('38.4', lang='ru', to='currency', seperator=' и', + num2words('38.4', lang='ru', to='currency', separator=' и', cents=False, currency='EUR'), "тридцать восемь евро и 40 центов" ) diff -Nru python-num2words-0.5.9/tests/test_sl.py python-num2words-0.5.10/tests/test_sl.py --- python-num2words-0.5.9/tests/test_sl.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_sl.py 2019-05-12 15:48:38.000000000 +0000 @@ -22,7 +22,7 @@ from num2words import num2words -class Num2WordsDETest(TestCase): +class Num2WordsSLTest(TestCase): def test_ordinal_less_than_twenty(self): self.assertEqual(num2words(2, ordinal=True, lang='sl'), "drugi") self.assertEqual(num2words(4, ordinal=True, lang='sl'), "četrti") @@ -43,17 +43,160 @@ num2words(4000, ordinal=True, lang='sl'), "štiritisoči" ) self.assertEqual( - num2words(2000000, ordinal=True, lang='sl'), "dvemiljonti" + num2words(2000000, ordinal=True, lang='sl'), "dvamilijonti" ) self.assertEqual( - num2words(5000000000, ordinal=True, lang='sl'), "petmiljardti" + num2words(5000000000, ordinal=True, lang='sl'), "petmilijardti" ) + def test_ordinal_numbers_from_repository_of_test_cases(self): + # Tests were compiled from cases in + # https://github.com/gregopet/zapis-slovenskih-stevil + # The male gender is used by the project so those test cases were + # copied + self.assertEqual(num2words(1, ordinal=True, lang='sl'), "prvi") + self.assertEqual(num2words(2, ordinal=True, lang='sl'), "drugi") + self.assertEqual(num2words(3, ordinal=True, lang='sl'), "tretji") + self.assertEqual(num2words(4, ordinal=True, lang='sl'), "četrti") + self.assertEqual(num2words(5, ordinal=True, lang='sl'), "peti") + self.assertEqual(num2words(6, ordinal=True, lang='sl'), "šesti") + self.assertEqual(num2words(7, ordinal=True, lang='sl'), "sedmi") + self.assertEqual(num2words(8, ordinal=True, lang='sl'), "osmi") + self.assertEqual(num2words(9, ordinal=True, lang='sl'), "deveti") + self.assertEqual(num2words(10, ordinal=True, lang='sl'), "deseti") + self.assertEqual(num2words(100, ordinal=True, lang='sl'), "stoti") + self.assertEqual(num2words(101, ordinal=True, lang='sl'), "stoprvi") + self.assertEqual(num2words(102, ordinal=True, lang='sl'), "stodrugi") + self.assertEqual(num2words(103, ordinal=True, lang='sl'), "stotretji") + self.assertEqual(num2words(104, ordinal=True, lang='sl'), "stočetrti") + self.assertEqual(num2words(105, ordinal=True, lang='sl'), "stopeti") + self.assertEqual(num2words(106, ordinal=True, lang='sl'), "stošesti") + self.assertEqual(num2words(200, ordinal=True, lang='sl'), "dvestoti") + self.assertEqual(num2words(1000, ordinal=True, lang='sl'), "tisoči") + self.assertEqual(num2words(1001, ordinal=True, lang='sl'), "tisočprvi") + self.assertEqual(num2words(1002, ordinal=True, lang='sl'), + "tisočdrugi") + self.assertEqual(num2words(1003, ordinal=True, lang='sl'), + "tisočtretji") + self.assertEqual(num2words(1004, ordinal=True, lang='sl'), + "tisoččetrti") + self.assertEqual(num2words(1005, ordinal=True, lang='sl'), + "tisočpeti") + self.assertEqual(num2words(1006, ordinal=True, lang='sl'), + "tisočšesti") + self.assertEqual(num2words(2000, ordinal=True, lang='sl'), + "dvatisoči") + self.assertEqual(num2words(20000, ordinal=True, lang='sl'), + "dvajsettisoči") + self.assertEqual(num2words(200000, ordinal=True, lang='sl'), + "dvestotisoči") + self.assertEqual(num2words(1000000, ordinal=True, lang='sl'), + "milijonti") + self.assertEqual(num2words(2000000, ordinal=True, lang='sl'), + "dvamilijonti") + self.assertEqual(num2words(3000000, ordinal=True, lang='sl'), + "trimilijonti") + self.assertEqual(num2words(101000000, ordinal=True, lang='sl'), + "stoenmilijonti") + self.assertEqual(num2words(202000000, ordinal=True, lang='sl'), + "dvestodvamilijonti") + self.assertEqual(num2words(1121, ordinal=True, lang='sl'), + "tisočstoenaindvajseti") + self.assertEqual(num2words(2405, ordinal=True, lang='sl'), + "dvatisočštiristopeti") + def test_cardinal_at_some_numbers(self): self.assertEqual(num2words(2, lang='sl'), "dve") self.assertEqual(num2words(4000, lang='sl'), "štiri tisoč") - self.assertEqual(num2words(2000000, lang='sl'), "dva miljona") - self.assertEqual(num2words(4000000000, lang='sl'), "štiri miljarde") + self.assertEqual(num2words(2000000, lang='sl'), "dva milijona") + self.assertEqual(num2words(4000000000, lang='sl'), "štiri milijarde") + + def test_cardinal_numbers_from_repository_of_test_cases(self): + # Tests were compiled from cases in + # https://github.com/gregopet/zapis-slovenskih-stevil + self.assertEqual(num2words(0, lang='sl'), "nič") + self.assertEqual(num2words(1, lang='sl'), "ena") + self.assertEqual(num2words(2, lang='sl'), "dve") + self.assertEqual(num2words(3, lang='sl'), "tri") + self.assertEqual(num2words(4, lang='sl'), "štiri") + self.assertEqual(num2words(5, lang='sl'), "pet") + self.assertEqual(num2words(6, lang='sl'), "šest") + self.assertEqual(num2words(7, lang='sl'), "sedem") + self.assertEqual(num2words(8, lang='sl'), "osem") + self.assertEqual(num2words(9, lang='sl'), "devet") + self.assertEqual(num2words(10, lang='sl'), "deset") + self.assertEqual(num2words(11, lang='sl'), "enajst") + self.assertEqual(num2words(12, lang='sl'), "dvanajst") + self.assertEqual(num2words(13, lang='sl'), "trinajst") + self.assertEqual(num2words(14, lang='sl'), "štirinajst") + self.assertEqual(num2words(15, lang='sl'), "petnajst") + self.assertEqual(num2words(16, lang='sl'), "šestnajst") + self.assertEqual(num2words(17, lang='sl'), "sedemnajst") + self.assertEqual(num2words(18, lang='sl'), "osemnajst") + self.assertEqual(num2words(19, lang='sl'), "devetnajst") + self.assertEqual(num2words(20, lang='sl'), "dvajset") + self.assertEqual(num2words(21, lang='sl'), "enaindvajset") + self.assertEqual(num2words(22, lang='sl'), "dvaindvajset") + self.assertEqual(num2words(23, lang='sl'), "triindvajset") + self.assertEqual(num2words(24, lang='sl'), "štiriindvajset") + self.assertEqual(num2words(25, lang='sl'), "petindvajset") + self.assertEqual(num2words(26, lang='sl'), "šestindvajset") + self.assertEqual(num2words(27, lang='sl'), "sedemindvajset") + self.assertEqual(num2words(28, lang='sl'), "osemindvajset") + self.assertEqual(num2words(29, lang='sl'), "devetindvajset") + self.assertEqual(num2words(30, lang='sl'), "trideset") + self.assertEqual(num2words(40, lang='sl'), "štirideset") + self.assertEqual(num2words(50, lang='sl'), "petdeset") + self.assertEqual(num2words(60, lang='sl'), "šestdeset") + self.assertEqual(num2words(70, lang='sl'), "sedemdeset") + self.assertEqual(num2words(80, lang='sl'), "osemdeset") + self.assertEqual(num2words(90, lang='sl'), "devetdeset") + self.assertEqual(num2words(100, lang='sl'), "sto") + self.assertEqual(num2words(101, lang='sl'), "sto ena") + self.assertEqual(num2words(102, lang='sl'), "sto dve") + self.assertEqual(num2words(103, lang='sl'), "sto tri") + self.assertEqual(num2words(104, lang='sl'), "sto štiri") + self.assertEqual(num2words(105, lang='sl'), "sto pet") + self.assertEqual(num2words(106, lang='sl'), "sto šest") + self.assertEqual(num2words(200, lang='sl'), "dvesto") + self.assertEqual(num2words(300, lang='sl'), "tristo") + self.assertEqual(num2words(400, lang='sl'), "štiristo") + self.assertEqual(num2words(500, lang='sl'), "petsto") + self.assertEqual(num2words(600, lang='sl'), "šeststo") + self.assertEqual(num2words(700, lang='sl'), "sedemsto") + self.assertEqual(num2words(800, lang='sl'), "osemsto") + self.assertEqual(num2words(900, lang='sl'), "devetsto") + self.assertEqual(num2words(1000, lang='sl'), "tisoč") + self.assertEqual(num2words(1001, lang='sl'), "tisoč ena") + self.assertEqual(num2words(1002, lang='sl'), "tisoč dve") + self.assertEqual(num2words(1003, lang='sl'), "tisoč tri") + self.assertEqual(num2words(1004, lang='sl'), "tisoč štiri") + self.assertEqual(num2words(1005, lang='sl'), "tisoč pet") + self.assertEqual(num2words(1006, lang='sl'), "tisoč šest") + self.assertEqual(num2words(2000, lang='sl'), "dva tisoč") + self.assertEqual(num2words(20000, lang='sl'), "dvajset tisoč") + self.assertEqual(num2words(100000, lang='sl'), "sto tisoč") + self.assertEqual(num2words(101000, lang='sl'), "sto en tisoč") + self.assertEqual(num2words(200000, lang='sl'), "dvesto tisoč") + self.assertEqual(num2words(1000000, lang='sl'), "milijon") + self.assertEqual(num2words(2000000, lang='sl'), "dva milijona") + self.assertEqual(num2words(3000000, lang='sl'), "trije milijoni") + self.assertEqual(num2words(101000000, lang='sl'), "sto en milijon") + self.assertEqual(num2words(202000000, lang='sl'), + "dvesto dva milijona") + self.assertEqual(num2words(303000000, lang='sl'), + "tristo trije milijoni") + self.assertEqual(num2words(304000000, lang='sl'), + "tristo štirje milijoni") + self.assertEqual(num2words(1000000000, lang='sl'), "milijarda") + self.assertEqual(num2words(2000000000, lang='sl'), "dve milijardi") + self.assertEqual(num2words(1121, lang='sl'), "tisoč sto enaindvajset") + self.assertEqual(num2words(2401, lang='sl'), "dva tisoč štiristo ena") + self.assertEqual(num2words(201001004, lang='sl'), + "dvesto en milijon tisoč štiri") + self.assertEqual( + num2words(1803603801, lang='sl'), + "milijarda osemsto trije milijoni šeststo tri tisoč osemsto ena") def test_cardinal_for_decimal_number(self): self.assertEqual(num2words(3.48, lang='sl'), "tri celih štiri osem") diff -Nru python-num2words-0.5.9/tests/test_sr.py python-num2words-0.5.10/tests/test_sr.py --- python-num2words-0.5.9/tests/test_sr.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_sr.py 2019-05-12 15:48:38.000000000 +0000 @@ -203,7 +203,7 @@ lang='sr', to='currency', currency='EUR', - seperator=' i' + separator=' i' ) ) self.assertEqual( @@ -213,18 +213,18 @@ lang='sr', to='currency', currency='RUB', - seperator=' i' + separator=' i' ) ) self.assertEqual( 'sto jedna rublja i dvadeset dve kopejke', num2words(10122, lang='sr', to='currency', currency='RUB', - seperator=' i') + separator=' i') ) self.assertEqual( 'sto jedan evro i dvadeset jedan cent', num2words(10121, lang='sr', to='currency', currency='EUR', - seperator=' i'), + separator=' i'), ) self.assertEqual( 'minus dvanaest hiljada petsto devetnaest evra, 85 centi', @@ -238,6 +238,6 @@ ) self.assertEqual( "trideset osam evra i 40 centi", - num2words('38.4', lang='sr', to='currency', seperator=' i', + num2words('38.4', lang='sr', to='currency', separator=' i', cents=False, currency='EUR'), ) diff -Nru python-num2words-0.5.9/tests/test_tr.py python-num2words-0.5.10/tests/test_tr.py --- python-num2words-0.5.9/tests/test_tr.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_tr.py 2019-05-12 15:48:38.000000000 +0000 @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +# Copyright (c) 2017, Tufan Kaynak, Framras. All Rights Reserved. # Copyright (c) 2003, Taro Ogawa. All Rights Reserved. # Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved. diff -Nru python-num2words-0.5.9/tests/test_uk.py python-num2words-0.5.10/tests/test_uk.py --- python-num2words-0.5.9/tests/test_uk.py 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tests/test_uk.py 2019-05-12 15:48:38.000000000 +0000 @@ -100,27 +100,27 @@ ) # self.assertEqual( # num2words(10111, lang='uk', to='currency', currency='EUR', - # seperator=u' та'), + # separator=u' та'), # "сто один євро та одинадцять центiв" # ) self.assertEqual( num2words(10121, lang='uk', to='currency', currency='UAH', - seperator=u' та'), + separator=u' та'), "сто одна гривня та двадцять одна копiйка" ) self.assertEqual( num2words(10121, lang='uk', to='currency', currency='UAH', - seperator=u' та'), + separator=u' та'), "сто одна гривня та двадцять одна копiйка" ) self.assertEqual( num2words(10122, lang='uk', to='currency', currency='UAH', - seperator=u' та'), + separator=u' та'), "сто одна гривня та двадцять двi копiйки" ) # self.assertEqual( # num2words(10121, lang='uk', to='currency', currency='EUR', - # seperator=u' та'), + # separator=u' та'), # "сто один євро та двадцять один цент" # ) self.assertEqual( @@ -129,7 +129,7 @@ "мiнус дванадцять тисяч п'ятсот дев'ятнадцять євро, 85 центiв" ) self.assertEqual( - num2words('38.4', lang='uk', to='currency', seperator=' и', + num2words('38.4', lang='uk', to='currency', separator=' и', cents=False, currency='EUR'), "тридцять вiсiм євро и 40 центiв" ) diff -Nru python-num2words-0.5.9/tox.ini python-num2words-0.5.10/tox.ini --- python-num2words-0.5.9/tox.ini 2019-01-11 01:09:08.000000000 +0000 +++ python-num2words-0.5.10/tox.ini 2019-05-12 15:48:38.000000000 +0000 @@ -26,3 +26,7 @@ delegator.py commands = isort --check-only --recursive --diff num2words tests + +[testenv:py27] +setenv = + PYTHONIOENCODING = UTF-8