From 9789fcddfbcd2a09bfe124b32dfedfa12e43d61e Mon Sep 17 00:00:00 2001 From: Jesse-njx <269665100+Jesse-njx@users.noreply.github.com> Date: Thu, 29 Oct 2026 13:42:15 -0400 Subject: [PATCH] Only join multiple timeframes with a conjunction --- arrow/locales.py | 2 +- tests/test_locales.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/arrow/locales.py b/arrow/locales.py index 757df480d..efe8b1e30 100644 --- a/arrow/locales.py +++ b/arrow/locales.py @@ -160,7 +160,7 @@ def describe_multi( self._format_timeframe(timeframe, trunc(delta)) for timeframe, delta in timeframes ] - if self.and_word: + if self.and_word and len(parts) > 1: parts.insert(-1, self.and_word) humanized = " ".join(parts) diff --git a/tests/test_locales.py b/tests/test_locales.py index 3d7120e36..382b14f25 100644 --- a/tests/test_locales.py +++ b/tests/test_locales.py @@ -111,6 +111,19 @@ def test_describe(self): assert self.locale.describe("now", only_distance=True) == "instantly" assert self.locale.describe("now", only_distance=False) == "just now" + @pytest.mark.parametrize("delta", [-2, 2]) + @pytest.mark.parametrize("only_distance", [False, True]) + def test_describe_multi_single_timeframe(self, delta, only_distance): + assert self.locale.describe_multi( + [("hours", delta)], only_distance=only_distance + ) == self.locale.describe("hours", delta, only_distance=only_distance) + + def test_describe_multi_conjunction(self): + assert ( + self.locale.describe_multi([("hours", 2), ("minutes", 3)]) + == "in 2 hours and 3 minutes" + ) + def test_format_timeframe(self): assert self.locale._format_timeframe("hours", 2) == "2 hours" assert self.locale._format_timeframe("hour", 0) == "an hour"