Skip to content

Commit c5722c4

Browse files
committed
wip
1 parent 6a5d92c commit c5722c4

File tree

3 files changed

+5
-38
lines changed

3 files changed

+5
-38
lines changed

pandas/tests/frame/indexing/test_indexing.py

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -845,35 +845,11 @@ def test_setitem_single_column_mixed_datetime(self):
845845

846846
def test_setitem_mixed_datetime(self):
847847
# GH 9336
848-
expected = DataFrame(
849-
{
850-
"a": [0, 0, 0, 0, 13, 14],
851-
"b": [
852-
datetime(2012, 1, 1),
853-
1,
854-
"x",
855-
"y",
856-
datetime(2013, 1, 1),
857-
datetime(2014, 1, 1),
858-
],
859-
}
860-
)
861848
df = DataFrame(0, columns=list("ab"), index=range(6))
862849
df["b"] = pd.NaT
863850
df.loc[0, "b"] = datetime(2012, 1, 1)
864-
with tm.assert_produces_warning(
865-
FutureWarning, match="Setting an item of incompatible dtype"
866-
):
851+
with pytest.raises(TypeError, match="Invalid value"):
867852
df.loc[1, "b"] = 1
868-
df.loc[[2, 3], "b"] = "x", "y"
869-
A = np.array(
870-
[
871-
[13, np.datetime64("2013-01-01T00:00:00")],
872-
[14, np.datetime64("2014-01-01T00:00:00")],
873-
]
874-
)
875-
df.loc[[4, 5], ["a", "b"]] = A
876-
tm.assert_frame_equal(df, expected)
877853

878854
def test_setitem_frame_float(self, float_frame):
879855
piece = float_frame.loc[float_frame.index[:2], ["A", "B"]]
@@ -1356,12 +1332,8 @@ def test_loc_setitem_rhs_frame(self, idxr, val):
13561332
# GH#47578
13571333
df = DataFrame({"a": [1, 2]})
13581334

1359-
with tm.assert_produces_warning(
1360-
FutureWarning, match="Setting an item of incompatible dtype"
1361-
):
1335+
with pytest.raises(TypeError, match="Invalid value"):
13621336
df.loc[:, idxr] = DataFrame({"a": [val, 11]}, index=[1, 2])
1363-
expected = DataFrame({"a": [np.nan, val]})
1364-
tm.assert_frame_equal(df, expected)
13651337

13661338
def test_iloc_setitem_enlarge_no_warning(self):
13671339
# GH#47381

pandas/tests/frame/indexing/test_set_value.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import numpy as np
2+
import pytest
23

34
from pandas.core.dtypes.common import is_float_dtype
45

56
from pandas import (
67
DataFrame,
78
isna,
89
)
9-
import pandas._testing as tm
1010

1111

1212
class TestSetValue:
@@ -40,11 +40,8 @@ def test_set_value_resize(self, float_frame, using_infer_string):
4040
assert is_float_dtype(res["baz"])
4141
assert isna(res["baz"].drop(["foobar"])).all()
4242

43-
with tm.assert_produces_warning(
44-
FutureWarning, match="Setting an item of incompatible dtype"
45-
):
43+
with pytest.raises(TypeError, match="Invalid value"):
4644
res._set_value("foobar", "baz", "sam")
47-
assert res.loc["foobar", "baz"] == "sam"
4845

4946
def test_set_value_with_index_dtype_change(self):
5047
df_orig = DataFrame(

pandas/tests/series/methods/test_update.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,9 @@ def test_update(self):
6262
def test_update_dtypes(self, other, dtype, expected, warn):
6363
ser = Series([10, 11, 12], dtype=dtype)
6464
other = Series(other, index=[1, 3])
65-
with tm.assert_produces_warning(warn, match="item of incompatible dtype"):
65+
with pytest.raises(TypeError, match="Invalid value"):
6666
ser.update(other)
6767

68-
tm.assert_series_equal(ser, expected)
69-
7068
@pytest.mark.parametrize(
7169
"values, other, expected",
7270
[

0 commit comments

Comments
 (0)