Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1302 +/- ##
=======================================
Coverage 92.18% 92.19%
=======================================
Files 27 27
Lines 4758 4764 +6
=======================================
+ Hits 4386 4392 +6
Misses 372 372
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Merging this PR will degrade performance by 12.57%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
01cc785 to
a007691
Compare
|
Good catch by codspeed: we don't need to slow down all unit operations, just those that would fail due to deprecated aliases. We'll just have to accept some degradation here. |
f6b02a7 to
9d7c063
Compare
There was a problem hiding this comment.
Pull request overview
Updates Babel’s bundled CLDR baseline to 48.2, aligning formatting behavior and tests with upstream CLDR changes and adding compatibility handling for newly-deprecated unit identifiers.
Changes:
- Bump reported CLDR version to 48 and update CLDR download/import scripts to target CLDR 48.2.
- Adjust tests for CLDR-driven output changes (currency/compact currency bidi marks, list formatting, Thai skeleton output, timezone name, currency counts).
- Add deprecated unit-id remapping with
DeprecationWarningemission for CLDR 48 unit identifier deprecations.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_units.py | Updates a unit ID expectation and adds a new test asserting deprecation warnings for deprecated unit identifiers. |
| tests/test_support_format.py | Updates expected bidi-mark placement for Arabic (Egypt) compact currency formatting. |
| tests/test_numbers.py | Updates expected currency list size and CLDR-driven formatting outputs (currency + compact currency). |
| tests/test_lists.py | Updates Nepali list formatting expectations (spacing/punctuation). |
| tests/test_dates.py | Updates Thai skeleton formatting expectations and a timezone display name expectation. |
| tests/test_core.py | Updates the asserted CLDR major version returned by get_cldr_version(). |
| scripts/import_cldr.py | Removes “up-to-date” short-circuiting and makes conversion always run; keeps legacy --force flag semantics. |
| scripts/download_import_cldr.py | Points the downloader at CLDR 48.2 and updates the expected SHA-512 checksum. |
| babel/units.py | Introduces deprecated unit-id remapping + deprecation warnings before falling back to fuzzy matching. |
| babel/numbers.py | Updates format_currency doctest output to reflect CLDR 48 behavior for COP rounding/formatting. |
| babel/core.py | Updates get_cldr_version() doctest from 47 to 48. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 10 out of 11 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
babel/units.py:90
- The deprecated-unit mapping is only applied for exact key matches (
new_id in unit_patterns). Ifnew_idis not an exact key (e.g. when mapping from an unqualified ID like"portion" -> "part"), the code falls through to fuzzy matching using the deprecatedunit_id, so the mapping may not take effect and can still raiseUnknownUnitError.
After warning, update unit_id to new_id so that the subsequent fuzzy matching resolves the replacement ID instead of the deprecated one.
new_id = _DEPRECATED_UNIT_IDS.get(unit_id)
if new_id is not None:
warnings.warn(
f"Unit identifier {unit_id!r} is deprecated; use {new_id!r} instead.",
DeprecationWarning,
- Unit IDs renamed in 48 still work (with deprecation warnings raised)
I had apparently implemented this in the spring but forgor about it? Well.