Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
add test, fix typo
  • Loading branch information
natmokval committed Nov 21, 2025
commit 2e0959193be4a2a1d03f3f899011009cceae3bb7
4 changes: 2 additions & 2 deletions pandas/_libs/tslibs/timedeltas.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2315,8 +2315,8 @@ class Timedelta(_Timedelta):
elif is_bool_object(other):
# GH#62316
raise TypeError(
"Cannot multiply Timedelta by bools. "
"Explicitly cast to integers instead."
"Cannot multiply Timedelta by bool. "
"Explicitly cast to integer instead."
)

return NotImplemented
Expand Down
6 changes: 6 additions & 0 deletions pandas/tests/scalar/timedelta/test_arithmetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -970,6 +970,12 @@ def test_td_op_timedelta_timedeltalike_array(self, op, arr):
with pytest.raises(TypeError, match=msg):
op(arr, Timedelta("1D"))

def test_mul_bool_invalid(self):
# GH#62316
msg = "Cannot multiply Timedelta by bool. Explicitly cast to integer"
with pytest.raises(TypeError, match=msg):
Timedelta("1 day") * True


class TestTimedeltaComparison:
def test_compare_pytimedelta_bounds(self):
Expand Down
Loading