Skip to content

Commit bb41261

Browse files
TST: update with duplicate frame index pandas-dev#55509
1 parent 2635c05 commit bb41261

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

pandas/tests/frame/methods/test_update.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,15 @@ def test_update_preserve_dtype(self, value_df, value_other, dtype):
209209

210210
def test_update_raises_on_duplicate_argument_index(self):
211211
# GH#55509
212-
df = DataFrame({"a": [True, True]}, index=[1, 2])
213-
other = DataFrame({"a": [False, False]}, index=[1, 1])
212+
df = DataFrame({"a": [1, 1]}, index=[1, 2])
213+
other = DataFrame({"a": [2, 3]}, index=[1, 1])
214214
with pytest.raises(ValueError, match="duplicate index"):
215215
df.update(other)
216+
217+
def test_update_on_duplicate_frame_unique_argument_index(self):
218+
# GH#55509
219+
df = DataFrame({"a": [1, 1, 1]}, index=[1, 1, 2])
220+
other = DataFrame({"a": [2, 3]}, index=[1,2])
221+
expected = DataFrame({"a": [2,2,3]}, index=[1, 1, 2])
222+
df.update(other)
223+
tm.assert_frame_equal(df, expected)

0 commit comments

Comments
 (0)