Skip to content

Commit b62e5a7

Browse files
committed
test: add test
1 parent 850c872 commit b62e5a7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

pandas/_libs/tslibs/timedeltas.pyx

-1
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ cdef convert_to_timedelta64(object ts, str unit):
369369
raise TypeError(f"Invalid type for timedelta scalar: {type(ts)}")
370370
return ts.astype("timedelta64[ns]")
371371

372-
373372
cdef create_timedelta_from_parts(
374373
int64_t days=0, int64_t hours=0, int64_t minutes=0, int64_t seconds=0,
375374
int64_t milliseconds=0, int64_t microseconds=0, int64_t nanoseconds=0):

pandas/tests/scalar/timedelta/test_timedelta.py

+6
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,12 @@ def test_replace_single_field(self):
682682
td = Timedelta(days=1, hours=5, minutes=45, seconds=30, milliseconds=250,
683683
microseconds=125, nanoseconds=60)
684684

685+
# Test replacing only days
686+
replaced = td.replace(days=2)
687+
expected = Timedelta(days=2, hours=5, minutes=45, seconds=30, milliseconds=250,
688+
microseconds=125, nanoseconds=60)
689+
assert replaced == expected, f"Expected {expected}, but got {replaced}"
690+
685691
# Test replacing only seconds
686692
replaced = td.replace(seconds=45)
687693
expected = Timedelta(days=1, hours=5, minutes=45, seconds=45, milliseconds=250,

0 commit comments

Comments
 (0)