fix: use isupper/islower for case validators#1775
Conversation
text == text.upper() accepted empty and digit-only strings; match IFEvalG. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Code Review
This pull request updates the validate_uppercase and validate_lowercase functions in open_instruct/if_functions.py to use Python's built-in str.isupper() and str.islower() methods instead of comparing the string to its upper/lower-cased version. This ensures that empty strings and strings containing only non-letter characters correctly fail validation. Additionally, corresponding unit tests have been added to open_instruct/test_if_functions.py to verify these behaviors, and the CHANGELOG.md has been updated. There are no review comments, so I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Summary
text == text.upper()/lower()accepted empty and digit-only strings.str.isupper/str.islowerlike IFEvalG.Test plan
TestValidateUpperLowerGPU_TESTS=bypass
CHANGELOG=