Skip to content

Commit 1a9fa40

Browse files
committed
add test cases
1 parent a62c896 commit 1a9fa40

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

pandas/tests/series/methods/test_replace.py

+32
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,38 @@ def test_replace_only_one_dictlike_arg(self):
413413
),
414414
(pd.Series([1, 2], dtype="int64"), {1: 10, 2: 20}, "int64"),
415415
(pd.Series([True, False], dtype="bool"), {True: False}, "bool"),
416+
(
417+
pd.Series(pd.interval_range(0, 5), dtype=pd.IntervalDtype("int64")),
418+
{pd.Interval(0, 1): pd.Interval(10, 20)},
419+
"interval[int64]",
420+
),
421+
(
422+
pd.Series(pd.interval_range(0, 1), dtype=pd.IntervalDtype("float64")),
423+
{pd.Interval(0.0, 1.0): pd.Interval(0.2, 0.3)},
424+
"interval[float64]",
425+
),
426+
(
427+
pd.Series([pd.Period("2020-05", freq="M")], dtype=pd.PeriodDtype("M")),
428+
{pd.Period("2020-05", freq="M"): pd.Period("2020-06", freq="M")},
429+
"period[M]",
430+
),
431+
(
432+
pd.Series(
433+
pd.arrays.DatetimeArray(
434+
np.array(
435+
["2000-01-01T12:00:00", "2000-01-02T12:00:00"],
436+
dtype="M8[ns]",
437+
),
438+
dtype=pd.DatetimeTZDtype(tz="US/Central"),
439+
)
440+
),
441+
{
442+
pd.Timestamp(
443+
"2000-01-01 06:00:00-0600", tz="US/Central"
444+
): pd.Timestamp("2000-01-01 12:00:00-0600", tz="US/Central")
445+
},
446+
"datetime64[ns, US/Central]",
447+
),
416448
],
417449
)
418450
def test_replace_dtype(self, series, to_replace, expected):

0 commit comments

Comments
 (0)