|
25 | 25 | Timestamp,
|
26 | 26 | date_range,
|
27 | 27 | isna,
|
28 |
| - notna, |
29 | 28 | to_datetime,
|
30 | 29 | )
|
31 | 30 | import pandas._testing as tm
|
@@ -936,12 +935,8 @@ def test_setitem_frame_upcast(self):
|
936 | 935 | # needs upcasting
|
937 | 936 | df = DataFrame([[1, 2, "foo"], [3, 4, "bar"]], columns=["A", "B", "C"])
|
938 | 937 | df2 = df.copy()
|
939 |
| - with tm.assert_produces_warning(FutureWarning, match="incompatible dtype"): |
| 938 | + with pytest.raises(TypeError, match="Invalid value"): |
940 | 939 | df2.loc[:, ["A", "B"]] = df.loc[:, ["A", "B"]] + 0.5
|
941 |
| - expected = df.reindex(columns=["A", "B"]) |
942 |
| - expected += 0.5 |
943 |
| - expected["C"] = df["C"] |
944 |
| - tm.assert_frame_equal(df2, expected) |
945 | 940 |
|
946 | 941 | def test_setitem_frame_align(self, float_frame):
|
947 | 942 | piece = float_frame.loc[float_frame.index[:2], ["A", "B"]]
|
@@ -1579,18 +1574,9 @@ def test_setitem(self):
|
1579 | 1574 | # With NaN: because uint64 has no NaN element,
|
1580 | 1575 | # the column should be cast to object.
|
1581 | 1576 | df2 = df.copy()
|
1582 |
| - with tm.assert_produces_warning(FutureWarning, match="incompatible dtype"): |
| 1577 | + with pytest.raises(TypeError, match="Invalid value"): |
1583 | 1578 | df2.iloc[1, 1] = pd.NaT
|
1584 | 1579 | df2.iloc[1, 2] = pd.NaT
|
1585 |
| - result = df2["B"] |
1586 |
| - tm.assert_series_equal(notna(result), Series([True, False, True], name="B")) |
1587 |
| - tm.assert_series_equal( |
1588 |
| - df2.dtypes, |
1589 |
| - Series( |
1590 |
| - [np.dtype("uint64"), np.dtype("O"), np.dtype("O")], |
1591 |
| - index=["A", "B", "C"], |
1592 |
| - ), |
1593 |
| - ) |
1594 | 1580 |
|
1595 | 1581 |
|
1596 | 1582 | def test_object_casting_indexing_wraps_datetimelike():
|
|
0 commit comments