Skip to content

Commit c5f314e

Browse files
committed
Fix is_between() reporting wrong type in end date error message
1 parent 2224255 commit c5f314e

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

arrow/arrow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1525,7 +1525,7 @@ def is_between(
15251525
)
15261526

15271527
if not isinstance(end, Arrow):
1528-
raise TypeError(f"Cannot parse end date argument type of {type(start)!r}.")
1528+
raise TypeError(f"Cannot parse end date argument type of {type(end)!r}.")
15291529

15301530
include_start = bounds[0] == "["
15311531
include_end = bounds[1] == "]"

tests/test_arrow.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3047,6 +3047,13 @@ def test_type_error_exception(self):
30473047
with pytest.raises(TypeError):
30483048
target.is_between(None, None)
30493049

3050+
def test_type_error_exception_message(self):
3051+
target = arrow.Arrow.fromdatetime(datetime(2013, 5, 7))
3052+
start = arrow.Arrow.fromdatetime(datetime(2013, 5, 5))
3053+
end = datetime(2013, 5, 8)
3054+
with pytest.raises(TypeError, match="argument type of <class 'datetime.datetime'>"):
3055+
target.is_between(start, end)
3056+
30503057
def test_value_error_exception(self):
30513058
target = arrow.Arrow.fromdatetime(datetime(2013, 5, 7))
30523059
start = arrow.Arrow.fromdatetime(datetime(2013, 5, 5))

0 commit comments

Comments
 (0)