Skip to content

Commit 3aa31dc

Browse files
committed
wip
1 parent 6bfbb53 commit 3aa31dc

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

pandas/tests/series/indexing/test_where.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,13 @@ def test_where_unsafe_upcast(dtype, expected_dtype):
5555
s = Series(np.arange(10), dtype=dtype)
5656
values = [2.5, 3.5, 4.5, 5.5, 6.5]
5757
mask = s < 5
58-
expected = Series(values + list(range(5, 10)), dtype=expected_dtype)
59-
warn = (
60-
None
61-
if np.dtype(dtype).kind == np.dtype(expected_dtype).kind == "f"
62-
else FutureWarning
63-
)
64-
with tm.assert_produces_warning(warn, match="incompatible dtype"):
58+
if np.dtype(dtype).kind == np.dtype(expected_dtype).kind == "f":
6559
s[mask] = values
66-
tm.assert_series_equal(s, expected)
60+
expected = Series(values + list(range(5, 10)), dtype=expected_dtype)
61+
tm.assert_series_equal(s, expected)
62+
else:
63+
with pytest.raises(TypeError, match="Invalid value"):
64+
s[mask] = values
6765

6866

6967
def test_where_unsafe():

pandas/tests/series/test_missing.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,8 @@ def test_timedelta64_nan(self):
3737
assert not isna(td1[0])
3838

3939
# GH#16674 iNaT is treated as an integer when given by the user
40-
with tm.assert_produces_warning(FutureWarning, match="incompatible dtype"):
40+
with pytest.raises(TypeError, match="Invalid value"):
4141
td1[1] = iNaT
42-
assert not isna(td1[1])
43-
assert td1.dtype == np.object_
44-
assert td1[1] == iNaT
45-
td1[1] = td[1]
46-
assert not isna(td1[1])
4742

4843
td1[2] = NaT
4944
assert isna(td1[2])

0 commit comments

Comments
 (0)