Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/tests/apply/test_frame_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@ def test_apply_on_empty_dataframe():
# GH 39111
df = DataFrame({"a": [1, 2], "b": [3, 0]})
result = df.head(0).apply(lambda x: max(x["a"], x["b"]), axis=1)
expected = Series([])
expected = Series([], dtype=np.float64)
tm.assert_series_equal(result, expected)


Expand Down
14 changes: 8 additions & 6 deletions pandas/tests/series/methods/test_fillna.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,16 @@ def test_fillna_consistency(self):
tm.assert_series_equal(result, expected)

# where (we ignore the errors=)
result = ser.where(
[True, False], Timestamp("20130101", tz="US/Eastern"), errors="ignore"
)
with tm.assert_produces_warning(FutureWarning, match="the 'errors' keyword"):
result = ser.where(
[True, False], Timestamp("20130101", tz="US/Eastern"), errors="ignore"
)
tm.assert_series_equal(result, expected)

result = ser.where(
[True, False], Timestamp("20130101", tz="US/Eastern"), errors="ignore"
)
with tm.assert_produces_warning(FutureWarning, match="the 'errors' keyword"):
result = ser.where(
[True, False], Timestamp("20130101", tz="US/Eastern"), errors="ignore"
)
tm.assert_series_equal(result, expected)

# with a non-datetime
Expand Down
11 changes: 7 additions & 4 deletions pandas/tests/series/test_ufunc.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,19 +434,22 @@ def __repr__(self) -> str:

def test_outer():
# https://github.com/pandas-dev/pandas/issues/27186
s = pd.Series([1, 2, 3])
o = np.array([1, 2, 3])
ser = pd.Series([1, 2, 3])
obj = np.array([1, 2, 3])

with pytest.raises(NotImplementedError, match=tm.EMPTY_STRING_PATTERN):
np.subtract.outer(s, o)
np.subtract.outer(ser, obj)


def test_np_matmul():
# GH26650
df1 = pd.DataFrame(data=[[-1, 1, 10]])
df2 = pd.DataFrame(data=[-1, 1, 10])
expected_result = pd.DataFrame(data=[102])

with tm.assert_produces_warning(FutureWarning, match="on non-aligned"):
result = np.matmul(df1, df2)
tm.assert_frame_equal(
expected_result,
np.matmul(df1, df2),
result,
)
4 changes: 3 additions & 1 deletion pandas/tests/util/test_assert_series_equal.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,12 @@ def test_series_equal_index_mismatch(check_index):


def test_series_invalid_param_combination():
left = Series(dtype=object)
right = Series(dtype=object)
with pytest.raises(
ValueError, match="check_like must be False if check_index is False"
):
tm.assert_series_equal(Series(), Series(), check_index=False, check_like=True)
tm.assert_series_equal(left, right, check_index=False, check_like=True)


def test_series_equal_length_mismatch(rtol):
Expand Down
7 changes: 4 additions & 3 deletions pandas/tests/window/moments/test_moments_consistency_ewm.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,10 @@ def test_ewm_consistency_series_cov_corr(

# check that corr(x, y) == cov(x, y) / (std(x) *
# std(y))
corr_x_y = series_data.ewm(
com=com, min_periods=min_periods, adjust=adjust, ignore_na=ignore_na
).corr(series_data, bias=bias)
with tm.assert_produces_warning(FutureWarning, match="Passing additional kwargs"):
corr_x_y = series_data.ewm(
com=com, min_periods=min_periods, adjust=adjust, ignore_na=ignore_na
).corr(series_data, bias=bias)
std_x = series_data.ewm(
com=com, min_periods=min_periods, adjust=adjust, ignore_na=ignore_na
).std(bias=bias)
Expand Down