Skip to content

Commit 1868f07

Browse files
committed
added test for replace method from dict_like to dict_like for a pd.Series
1 parent e18a857 commit 1868f07

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pandas/tests/series/methods/test_replace.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,15 @@ def test_replace_only_one_dictlike_arg(self, fixed_now_ts):
496496
with pytest.raises(ValueError, match=msg):
497497
ser.replace(to_replace, value)
498498

499+
def test_replace_dict_like_with_dict_like(self):
500+
# GH 59452
501+
s = pd.Series([1, 2, 3, 4, 5])
502+
to_replace = pd.Series([1])
503+
value = pd.Series([75])
504+
msg = "Series.replace cannot use dict-like to_replace dict-like."
505+
with pytest.raises(ValueError, match=msg):
506+
s.replace(to_replace, value)
507+
499508
def test_replace_extension_other(self, frame_or_series):
500509
# https://github.com/pandas-dev/pandas/issues/34530
501510
obj = frame_or_series(pd.array([1, 2, 3], dtype="Int64"))

0 commit comments

Comments
 (0)