jaraco/inflect

inconsistency in handling spaces

Ouverte

#26 ouverte le 28 juil. 2015

 (3 commentaires) (0 réaction) (0 personne assignée)Python (125 forks)github user discovery
featurehelp wanted

Métriques du dépôt

Stars
 (1 082 étoiles)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

>>> p.number_to_words('11 11')
'one thousand, one hundred and eleven'
>>> p.ordinal(11)
'11th'
>>> p.ordinal('11 ')
'11 th'
>>> p.ordinal('11  ')
'11  th'
>>> p.ordinal('11 11')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ssara29/others/Abin/src/inflect/inflect.py", line 2797, in ordinal
    n = int(num)
ValueError: invalid literal for int() with base 10: '11 11'

While number_to_words is removing all intervening spaces, ordinal ain't doing the same. Why the inconsistency? Why isn't number_to_words complaining about the space?

Guide contributeur