Skip to content

Fix Hungarian distance-only humanization - #1409

Open
ViktorBystrov72 wants to merge 1 commit into
arrow-py:masterfrom
ViktorBystrov72:fix/hungarian-distance-suffixes
Open

ViktorBystrov72 wants to merge 1 commit into
arrow-py:masterfrom
ViktorBystrov72:fix/hungarian-distance-suffixes

Conversation

@ViktorBystrov72

@ViktorBystrov72 ViktorBystrov72 commented Nov 11, 2026 •

Copy link
Copy Markdown

Pull Request Checklist

  • 🧪 Added tests for changed code.
  • 🛠️ All tests pass when run locally.
  • 🧹 All linting checks pass when run locally.
  • 📚 Updated documentation for changed code.
  • ⏩ Code is up-to-date with the master branch.

Description of Changes

Closes #438.

For past dates, Hungarian humanize(..., only_distance=True) includes the case suffix used with "ago": for example, 17 évvel instead of 17 év. Use the locale's existing unsuffixed forms for distance-only output, including multi-component intervals. Relative descriptions still use their existing past/future forms.

The regression tests cover singular and plural units, both directions, zero components, the "now" case, multi-component output, and the public humanize() API with all Hungarian locale aliases. The original issue's example now returns 17 év; a two-day, three-hour interval returns 2 nap 3 óra.

Validation on macOS arm64, Python 3.14.4:

  • On unmodified master, the expanded Hungarian test class has 17 failures and 2 passing controls; all 19 pass with the fix.
  • Full suite: 1,920 passed, 99.93% total coverage. arrow/locales.py has 100% statement and branch coverage.
  • All pinned pre-commit hooks passed, including Black, Flake8, isort, and mypy.
  • git diff --check passed.

The full test run reports an existing dateutil.zoneinfo deprecation warning from tests/utils.py. The documented API contract is unchanged, so no documentation change is included.

CI note: the Ubuntu Python 3.8 and 3.9 jobs fail in actions/setup-python, before installation or tests, because those interpreter builds are unavailable on Ubuntu 26.04. The Windows PyPy job also fails before tests while installing PyYAML build dependencies (IncompleteRead(190689 bytes read, 1299 more expected)). All three failures occur identically on the unchanged upstream commit in the scheduled base run. The existing #1393 addresses these CI issues. Ubuntu Python 3.10–3.14 passed for this PR.

OpenAI Codex assisted with the implementation, regression tests, and PR description. The reported checks were run locally; no human review is claimed.

Use the existing future timeframe forms for standalone distances, including multi-part descriptions and zero values. Preserve the inflected past forms when relative wording is included.
@codecov

codecov Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (2224255) to head (7c3823b).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff            @@
##            master     #1409   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           10        10           
  Lines         2315      2325   +10     
  Branches       358       362    +4     
=========================================
+ Hits          2315      2325   +10     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

This branch has not been deployed

No deployments
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.

i18n issue with noun suffixes for .humanize(only_distance=True)

1 participant