Skip to content

fix(jinja): require cased characters for lower and upper tests - #2892

Open
smg99 wants to merge 1 commit into
huggingface:mainfrom
smg99:fix/jinja-uncased-string-tests
Open

smg99 wants to merge 1 commit into
huggingface:mainfrom
smg99:fix/jinja-uncased-string-tests

Conversation

@smg99

@smg99 smg99 commented Nov 19, 2026 •

Copy link
Copy Markdown

Empty strings, digits/punctuation, and uncased scripts currently pass both is lower and is upper. Case conversion equality also misclassifies Unicode characters such as ª that have a case property without an uppercase mapping.

Require at least one character with the relevant Unicode case property and reject characters with the opposite or title case property. Cover uncased strings, mixed case, accented letters, titlecase characters, and ª. This follows the string case predicates used by Jinja.

Validation: 776 tests pass across the templates, utilities, interpreter, formatting, and memory suites; Jinja build (including TypeScript declarations), ESLint, formatting, and git diff --check pass. Four regression cases fail before the change.

The model-download e2e suite is excluded: this checkout lacks a built @huggingface/hub workspace dependency.


Note

Low Risk
Localized change to built-in Jinja string tests with new regression tests; no auth, security, or API surface impact.

Overview
Fixes is lower and is upper so they match upstream Jinja instead of treating str === str.toLowerCase() / toUpperCase() as sufficient.

Each test now requires at least one Unicode character with the relevant case property and rejects opposite-case or titlecase (\p{Lt}) letters. Strings with no cased letters (empty, digits, punctuation, uncased scripts), mixed case, and edge cases like ª and Dž no longer incorrectly satisfy both tests.

Regression coverage was added under Feature regressions with parameterized is lower / is upper expectations.

Reviewed by Cursor Bugbot for commit 7921a76. Bugbot is set up for automated code reviews on this repo. Configure here.

@smg99
smg99 requested a review from xenova as a code owner November 19, 2026 05:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant