Skip to content

Omit the conjunction when describing a single timeframe - #1399

Open
Jesse-njx wants to merge 1 commit into
arrow-py:masterfrom
Jesse-njx:fix-single-timeframe-conjunction
Open

Jesse-njx wants to merge 1 commit into
arrow-py:masterfrom
Jesse-njx:fix-single-timeframe-conjunction

Conversation

@Jesse-njx

Copy link
Copy Markdown

Description of Changes

Locale.describe_multi() inserts its conjunction even when given only one timeframe. For example:

from arrow.locales import EnglishLocale

EnglishLocale().describe_multi([("hours", 2)])
# Before: "in and 2 hours"
# After:  "in 2 hours"

Only insert the conjunction when there are at least two formatted parts. Regression tests cover past and future values, only_distance=True and False, and continued use of and for two timeframes. The four single-timeframe cases fail on unchanged master and pass with the fix.

This corrects direct calls to the locale API. Arrow.humanize() already routes a single granularity through describe().

Validation

  • Python 3.14.6 on macOS: 1,907 tests passed, 99.93% coverage.
  • pre-commit run --all-files: all checks passed, including black, flake8, isort, and mypy.
  • Documentation: doc8 passed; Sphinx HTML build with -W --keep-going passed.
  • git diff --check: passed.

Pull Request Checklist

  • Added tests for changed code.
  • All tests pass when run locally.
  • All linting checks pass when run locally.
  • Code is up to date with the master branch.

No documentation changes are needed for this formatting correction.

AI assistance: OpenAI Codex (GPT-6) was used for source analysis, reproducing the bug, writing and reviewing the fix and tests, running validation, and drafting this PR. Validation was performed by the agent; no separate human review is claimed.

@codecov

codecov Bot commented Oct 29, 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 (9789fcd).
✅ All tests successful. No failed tests found.

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

☔ 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.

1 participant