diff --git a/pandas/tests/frame/indexing/test_insert.py b/pandas/tests/frame/indexing/test_insert.py index 4f5ec8eff29a6..c2c862be42625 100644 --- a/pandas/tests/frame/indexing/test_insert.py +++ b/pandas/tests/frame/indexing/test_insert.py @@ -89,3 +89,13 @@ def test_insert_item_cache(self, using_array_manager): ser.values[0] = 99 assert df.iloc[0, 0] == df[0][0] + + def test_insert_frame(self): + # GH#42403 + df = DataFrame({"col1": [1, 2], "col2": [3, 4]}) + msg = ( + "Expected a 1D array, got an array with shape " + r"\(2, 2\)|Wrong number of items passed 2, placement implies 1" + ) + with pytest.raises(ValueError, match=msg): + df.insert(1, "newcol", df)