Skip to content
Open
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
3 changes: 2 additions & 1 deletion boltons/strutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def pluralize(word):
plural = irr_plural
elif word.endswith('y') and word[-2:-1] not in 'aeiou':
plural = word[:-1] + 'ies'
elif word[-1] in 'sx' or word.endswith('ch') or word.endswith('sh'):
elif word[-1] in 'sxz' or word.endswith('ch') or word.endswith('sh'):
plural = word if word.endswith('es') else word + 'es'
else:
plural = word + 's'
Expand Down Expand Up @@ -303,6 +303,7 @@ def _match_case(master, disciple):
'octopus': 'octopi', 'offspring': 'offspring', 'ovum': 'ova',
'ox': 'oxen', 'paralysis': 'paralyses', 'parenthesis': 'parentheses',
'person': 'people', 'phenomenon': 'phenomena', 'potato': 'potatoes',
'quiz': 'quizzes',
'radius': 'radii', 'scarf': 'scarves', 'scissors': 'scissors',
'self': 'selves', 'sense': 'senses', 'series': 'series', 'sheep':
'sheep', 'shelf': 'shelves', 'species': 'species', 'stimulus':
Expand Down
9 changes: 9 additions & 0 deletions tests/test_strutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,3 +397,12 @@ def test_args2cmd_sep():
assert strutils.args2cmd(['aa', 'bb']) == 'aa bb'
assert strutils.args2cmd(['aa', 'bb'], sep='|') == 'aa|bb'
assert strutils.args2cmd(['a a', 'bb'], sep='|') == '"a a"|bb'


def test_pluralize_z():
pluralize = strutils.pluralize
assert pluralize('buzz') == 'buzzes'
assert pluralize('waltz') == 'waltzes'
assert pluralize('Fizz') == 'Fizzes'
assert pluralize('quiz') == 'quizzes'
assert strutils.singularize('quizzes') == 'quiz'