Skip to content

Commit 2e09591

Browse files
committed
add test, fix typo
1 parent 99e2351 commit 2e09591

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2315,8 +2315,8 @@ class Timedelta(_Timedelta):
23152315
elif is_bool_object(other):
23162316
# GH#62316
23172317
raise TypeError(
2318-
"Cannot multiply Timedelta by bools. "
2319-
"Explicitly cast to integers instead."
2318+
"Cannot multiply Timedelta by bool. "
2319+
"Explicitly cast to integer instead."
23202320
)
23212321

23222322
return NotImplemented

pandas/tests/scalar/timedelta/test_arithmetic.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,12 @@ def test_td_op_timedelta_timedeltalike_array(self, op, arr):
970970
with pytest.raises(TypeError, match=msg):
971971
op(arr, Timedelta("1D"))
972972

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

974980
class TestTimedeltaComparison:
975981
def test_compare_pytimedelta_bounds(self):

0 commit comments

Comments
 (0)