Repository navigation
Fix pluralize for words ending in z - #586
Debasishhh wants to merge 2 commits into
Conversation
Wkhanex
left a comment
There was a problem hiding this comment.
There is an adjacent singularize gap worth considering alongside the new z plural rule. At b4c338e, the new plurals are correct, but feeding them into the paired helper gives:
singularize(pluralize('buzz')) # 'buzze'
singularize(pluralize('waltz')) # 'waltze'
singularize(pluralize('topaz')) # 'topaze'The same issue affects fizz and is preserved in title/upper case, while the new irregular quiz entry round-trips correctly. Would it make sense to extend the reverse -zes handling and cover these round trips too? The singularize behavior for these already-plural strings predates this PR; this is an adjacent consistency gap, not a claim that the PR introduced that implementation defect.
I ran an independent expected-word/case matrix and the existing strutils tests on CPython 3.12.14. All 28 existing tests pass; the added round-trip check fails with the results above.
Review prepared with Codex assistance; the checks described above were executed locally.
|
Yeah singularize is already off for these, |
The change
pluralize()added a baresto words ending inz:#429 added
xto the-esrule butzwas missed. This addszto that rule (buzzes,waltzes,Fizzes), and addsquizto the irregular plurals so it becomesquizzes(andsingularize('quizzes')returnsquiz). A general z-doubling rule would be wrong for words liketopaz, soquizis listed explicitly.The backstory
Follow-up to #585, found during the same read-through.
AI assistance