From 1ba9f919b5edd6ebceb99238fb4d46b3638d952f Mon Sep 17 00:00:00 2001 From: Zo Bot Date: Fri, 10 Jul 2026 21:42:39 +0000 Subject: [PATCH] is_between: name the offending type of the end argument, not the start argument --- arrow/arrow.py | 2 +- tests/test_arrow.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/arrow/arrow.py b/arrow/arrow.py index eecf23266..6ed1f0460 100644 --- a/arrow/arrow.py +++ b/arrow/arrow.py @@ -1525,7 +1525,7 @@ def is_between( ) if not isinstance(end, Arrow): - raise TypeError(f"Cannot parse end date argument type of {type(start)!r}.") + raise TypeError(f"Cannot parse end date argument type of {type(end)!r}.") include_start = bounds[0] == "[" include_end = bounds[1] == "]" diff --git a/tests/test_arrow.py b/tests/test_arrow.py index b595e4e21..6b44c0b79 100644 --- a/tests/test_arrow.py +++ b/tests/test_arrow.py @@ -3047,6 +3047,16 @@ def test_type_error_exception(self): with pytest.raises(TypeError): target.is_between(None, None) + def test_is_between_error_message_mentions_end_type(self): + target = arrow.Arrow.fromdatetime(datetime(2013, 5, 7)) + start = arrow.Arrow.fromdatetime(datetime(2013, 5, 5)) + end = datetime(2013, 5, 8) + with pytest.raises(TypeError) as excinfo: + target.is_between(start, end) + assert "end" in str(excinfo.value) + assert "datetime" in str(excinfo.value) + assert "Arrow" not in str(excinfo.value) + def test_value_error_exception(self): target = arrow.Arrow.fromdatetime(datetime(2013, 5, 7)) start = arrow.Arrow.fromdatetime(datetime(2013, 5, 5))