Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix typo 'seperator' on source code #238

Merged
merged 1 commit into from
Jan 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions num2words/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,14 +263,14 @@ def _cents_verbose(self, number, currency):
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
Expand All @@ -297,7 +297,7 @@ def to_currency(self, val, currency='EUR', cents=True, seperator=',',
minus_str,
self.to_cardinal(left),
self.pluralize(left, cr1),
seperator,
separator,
cents_str,
self.pluralize(right, cr2)
)
Expand Down
4 changes: 2 additions & 2 deletions num2words/lang_ES.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ def to_ordinal_num(self, value):
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")
4 changes: 2 additions & 2 deletions num2words/lang_FI.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,10 +682,10 @@ def to_year(self, val, suffix=None, longval=True):
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):
Expand Down
2 changes: 1 addition & 1 deletion num2words/lang_HE.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def n2w(n):
return int2word(int(n))


def to_currency(n, currency='EUR', cents=True, seperator=','):
def to_currency(n, currency='EUR', cents=True, separator=','):
raise NotImplementedError()


Expand Down
2 changes: 1 addition & 1 deletion num2words/lang_JA.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def to_year(self, val, suffix=None, longval=True, reading=False,

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)
Expand Down
2 changes: 1 addition & 1 deletion num2words/lang_KO.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def to_year(self, val, suffix=None, longval=True):
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)
Expand Down
4 changes: 2 additions & 2 deletions num2words/lang_PT.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,13 @@ def to_year(self, val, longval=True):
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
Expand Down
6 changes: 3 additions & 3 deletions num2words/lang_SR.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ def _int2word(self, number, feminine=False):

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
Expand Down Expand Up @@ -210,7 +210,7 @@ def to_currency(self, val, currency='EUR', cents=True, seperator=',',
minus_str,
self.to_cardinal(left, feminine=cr1[-1]),
self.pluralize(left, cr1),
seperator,
separator,
cents_str,
self.pluralize(right, cr2)
)
6 changes: 3 additions & 3 deletions tests/test_cz.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ def test_currency(self):
"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(
Expand All @@ -97,7 +97,7 @@ def test_currency(self):
)
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(
Expand Down
18 changes: 9 additions & 9 deletions tests/test_en.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,54 +71,54 @@ def test_overflow(self):

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"
)
Expand Down
12 changes: 6 additions & 6 deletions tests/test_lv.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ def test_to_currency(self):
)

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"
)
Expand All @@ -122,26 +122,26 @@ def test_to_currency(self):
" 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"
)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_nl.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,24 @@ def test_ordinal_for_floating_numbers(self):

def test_to_currency(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')

Expand Down
6 changes: 3 additions & 3 deletions tests/test_pl.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ def test_currency(self):
)
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(
Expand All @@ -120,7 +120,7 @@ def test_currency(self):
)
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(
Expand Down
10 changes: 5 additions & 5 deletions tests/test_ru.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,22 +170,22 @@ def test_to_currency(self):
)
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(
Expand All @@ -194,7 +194,7 @@ def test_to_currency(self):
'минус двенадцать тысяч пятьсот девятнадцать евро, 85 центов'
)
self.assertEqual(
num2words('38.4', lang='ru', to='currency', seperator=' и',
num2words('38.4', lang='ru', to='currency', separator=' и',
cents=False, currency='EUR'),
"тридцать восемь евро и 40 центов"
)
Expand Down
10 changes: 5 additions & 5 deletions tests/test_sr.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def test_to_currency(self):
lang='sr',
to='currency',
currency='EUR',
seperator=' i'
separator=' i'
)
)
self.assertEqual(
Expand All @@ -213,18 +213,18 @@ def test_to_currency(self):
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',
Expand All @@ -238,6 +238,6 @@ def test_to_currency(self):
)
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'),
)
Loading