Skip to content

Commit

Permalink
Czech language ISO 639-1 code fix
Browse files Browse the repository at this point in the history
  • Loading branch information
TrangOul committed Oct 11, 2024
1 parent 8c712e9 commit 507ee5e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Besides the numerical argument, there are two main optional arguments, ``to:`` a
* ``be`` (Belarusian)
* ``ce`` (Chechen)
* ``cy`` (Welsh)
* ``cz`` (Czech)
* ``cs`` (Czech)
* ``de`` (German)
* ``dk`` (Danish)
* ``en_GB`` (English - Great Britain)
Expand Down
4 changes: 2 additions & 2 deletions num2words/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from __future__ import unicode_literals

from . import (lang_AM, lang_AR, lang_AZ, lang_BE, lang_CA, lang_CE, lang_CY,
lang_CZ, lang_DE, lang_DK, lang_EN, lang_EN_IN, lang_EN_NG,
lang_CS, lang_DE, lang_DK, lang_EN, lang_EN_IN, lang_EN_NG,
lang_EO, lang_ES, lang_ES_CO, lang_ES_CR, lang_ES_GT,
lang_ES_NI, lang_ES_VE, lang_FA, lang_FI, lang_FR, lang_FR_BE,
lang_FR_CH, lang_FR_DZ, lang_HE, lang_HU, lang_ID, lang_IS,
Expand All @@ -34,8 +34,8 @@
'be': lang_BE.Num2Word_BE(),
'ca': lang_CA.Num2Word_CA(),
'ce': lang_CE.Num2Word_CE(),
'cs': lang_CS.Num2Word_CS(),
'cy': lang_CY.Num2Word_CY(),
'cz': lang_CZ.Num2Word_CZ(),
'en': lang_EN.Num2Word_EN(),
'en_IN': lang_EN_IN.Num2Word_EN_IN(),
'en_NG': lang_EN_NG.Num2Word_EN_NG(),
Expand Down
2 changes: 1 addition & 1 deletion num2words/lang_CZ.py → num2words/lang_CS.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
}


class Num2Word_CZ(Num2Word_Base):
class Num2Word_CS(Num2Word_Base):
CURRENCY_FORMS = {
'CZK': (
('koruna', 'koruny', 'korun'), ('halíř', 'halíře', 'haléřů')
Expand Down
54 changes: 27 additions & 27 deletions tests/test_cz.py → tests/test_cs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,47 +22,47 @@
from num2words import num2words


class Num2WordsCZTest(TestCase):
class Num2WordsCSTest(TestCase):
def test_cardinal(self):
self.assertEqual(num2words(100, lang='cz'), "sto")
self.assertEqual(num2words(101, lang='cz'), "sto jedna")
self.assertEqual(num2words(110, lang='cz'), "sto deset")
self.assertEqual(num2words(115, lang='cz'), "sto patnáct")
self.assertEqual(num2words(123, lang='cz'), "sto dvacet tři")
self.assertEqual(num2words(1000, lang='cz'), "tisíc")
self.assertEqual(num2words(1001, lang='cz'), "tisíc jedna")
self.assertEqual(num2words(2012, lang='cz'), "dva tisíce dvanáct")
self.assertEqual(
num2words(10.02, lang='cz'),
self.assertEqual(num2words(100, lang='cs'), "sto")
self.assertEqual(num2words(101, lang='cs'), "sto jedna")
self.assertEqual(num2words(110, lang='cs'), "sto deset")
self.assertEqual(num2words(115, lang='cs'), "sto patnáct")
self.assertEqual(num2words(123, lang='cs'), "sto dvacet tři")
self.assertEqual(num2words(1000, lang='cs'), "tisíc")
self.assertEqual(num2words(1001, lang='cs'), "tisíc jedna")
self.assertEqual(num2words(2012, lang='cs'), "dva tisíce dvanáct")
self.assertEqual(
num2words(10.02, lang='cs'),
"deset celá nula dva"
)
self.assertEqual(
num2words(15.007, lang='cz'),
num2words(15.007, lang='cs'),
"patnáct celá nula nula sedm"
)
self.assertEqual(
num2words(12519.85, lang='cz'),
num2words(12519.85, lang='cs'),
"dvanáct tisíc pětset devatenáct celá osmdesát pět"
)
self.assertEqual(
num2words(123.50, lang='cz'),
num2words(123.50, lang='cs'),
"sto dvacet tři celá pět"
)
self.assertEqual(
num2words(1234567890, lang='cz'),
num2words(1234567890, lang='cs'),
"miliarda dvěstě třicet čtyři miliony pětset šedesát "
"sedm tisíc osmset devadesát"
)
self.assertEqual(
num2words(215461407892039002157189883901676, lang='cz'),
num2words(215461407892039002157189883901676, lang='cs'),
"dvěstě patnáct quintillionů čtyřista šedesát jedna kvadriliard "
"čtyřista sedm kvadrilionů osmset devadesát dva triliardy třicet "
"devět trilionů dva biliardy sto padesát sedm bilionů sto "
"osmdesát devět miliard osmset osmdesát tři miliony "
"devětset jedna tisíc šestset sedmdesát šest"
)
self.assertEqual(
num2words(719094234693663034822824384220291, lang='cz'),
num2words(719094234693663034822824384220291, lang='cs'),
"sedmset devatenáct quintillionů devadesát "
"čtyři kvadriliardy dvěstě třicet čtyři "
"kvadriliony šestset devadesát tři triliardy "
Expand All @@ -75,40 +75,40 @@ def test_cardinal(self):
def test_to_ordinal(self):
# @TODO: implement to_ordinal
with self.assertRaises(NotImplementedError):
num2words(1, lang='cz', to='ordinal')
num2words(1, lang='cs', to='ordinal')

def test_currency(self):
self.assertEqual(
num2words(10.0, lang='cz', to='currency', currency='EUR'),
num2words(10.0, lang='cs', to='currency', currency='EUR'),
"deset euro, nula centů")
self.assertEqual(
num2words(1.0, lang='cz', to='currency', currency='CZK'),
num2words(1.0, lang='cs', to='currency', currency='CZK'),
"jedna koruna, nula haléřů")
self.assertEqual(
num2words(1234.56, lang='cz', to='currency', currency='EUR'),
num2words(1234.56, lang='cs', to='currency', currency='EUR'),
"tisíc dvěstě třicet čtyři euro, padesát šest centů")
self.assertEqual(
num2words(1234.56, lang='cz', to='currency', currency='CZK'),
num2words(1234.56, lang='cs', to='currency', currency='CZK'),
"tisíc dvěstě třicet čtyři koruny, padesát šest haléřů")
self.assertEqual(
num2words(101.11, lang='cz', to='currency', currency='EUR',
num2words(101.11, lang='cs', to='currency', currency='EUR',
separator=' a'),
"sto jedna euro a jedenáct centů")
self.assertEqual(
num2words(101.21, lang='cz', to='currency', currency='CZK',
num2words(101.21, lang='cs', to='currency', currency='CZK',
separator=' a'),
"sto jedna korun a dvacet jedna haléřů"
)
self.assertEqual(
num2words(-12519.85, lang='cz', to='currency', cents=False),
num2words(-12519.85, lang='cs', to='currency', cents=False),
"mínus dvanáct tisíc pětset devatenáct euro, 85 centů"
)
self.assertEqual(
num2words(123.50, lang='cz', to='currency', currency='CZK',
num2words(123.50, lang='cs', to='currency', currency='CZK',
separator=' a'),
"sto dvacet tři koruny a padesát haléřů"
)
self.assertEqual(
num2words(19.50, lang='cz', to='currency', cents=False),
num2words(19.50, lang='cs', to='currency', cents=False),
"devatenáct euro, 50 centů"
)

0 comments on commit 507ee5e

Please sign in to comment.