Open
Description
if I do a manual python shell session, I can pluralize()
just fine. Similarly my application code when I run it, runs without any errors, exceptions. However when I run my unit tests for code that uses inflection.pluralize()
I get the error
word = 'network'
def pluralize(word):
"""
Return the plural form of a word.
Examples::
>>> pluralize("post")
"posts"
>>> pluralize("octopus")
"octopi"
>>> pluralize("sheep")
"sheep"
>>> pluralize("CamelOctopus")
"CamelOctopi"
"""
> if not word or word.lower() in UNCOUNTABLES:
E TypeError: argument of type 'NoneType' is not iterable
/usr/local/lib/python2.7/dist-packages/inflection.py:297: TypeError
3 failed, 50 passed in 0.14 seconds
When I run my tests using py.test --pdb
, I'm unable to print any value for UNCOUNTABLES
word = 'networkTopology'
def pluralize(word):
"""
Return the plural form of a word.
Examples::
>>> pluralize("post")
"posts"
>>> pluralize("octopus")
"octopi"
>>> pluralize("sheep")
"sheep"
>>> pluralize("CamelOctopus")
"CamelOctopi"
"""
> if not word or word.lower() in UNCOUNTABLES:
E TypeError: argument of type 'NoneType' is not iterable
/usr/local/lib/python2.7/dist-packages/inflection.py:297: TypeError
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> entering PDB >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /usr/local/lib/python2.7/dist-packages/inflection.py(297)pluralize()
-> if not word or word.lower() in UNCOUNTABLES:
(Pdb) UNCOUNTABLES
(Pdb) list
292 "sheep"
293 >>> pluralize("CamelOctopus")
294 "CamelOctopi"
295
296 """
297 -> if not word or word.lower() in UNCOUNTABLES:
298 return word
299 else:
300 for rule, replacement in PLURALS:
301 if re.search(rule, word):
302 return re.sub(rule, replacement, word)
(Pdb)
I'm using inflection==0.3.1
Metadata
Assignees
Labels
No labels
Activity