Repository navigation
Normalize negative inputs in generated JavaScript plural rules - #1414
Open
parijat1222q wants to merge 1 commit into
Open
parijat1222q wants to merge 1 commit into
parijat1222q wants to merge 1 commit into
Conversation
Use absolute values before evaluating generated plural rules, matching Python and the Unicode plural operand definition. Cover source output and JavaScript execution for negative and positive inputs. Fixes python-babel#1413
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Normalize
nwithMath.absonce before evaluating generated JavaScript plural rules. This matches Python'sextract_operandsand the Unicode definition of plural operands as absolute values.For
{'one': 'n is 1', 'few': 'n in 2..4'}, Python selectsonefor-1andfewfor-2, while the current generated JavaScript selectsotherfor both.Update the generated-source expectations and add always-on normalization checks for empty, direct, integer, modulo and range rules. Four execution tests compare the generated function with Python for negative integers/fractions, zero and positive controls. They use Node.js when available and skip only those execution tests otherwise, without adding a required dependency. All four execution regressions fail on unchanged master.
Validation against
9a3ef47, Linux, imported CLDR 48.2:git diff --checkpass.Test runs used process-local
TZ=UTC: two unrelated host-timezone assertions fail with Asia/Calcutta on both unchanged master and this branch. No tests were deselected. The existing pytest parametrization warning remains. Windows/macOS were not run locally; upstream CI is still pending.Fixes #1413