Skip to content

Commit fe857a4

Browse files
committed
fix tests
1 parent 6a0f6c2 commit fe857a4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pandas/tests/apply/test_series_apply.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -381,15 +381,16 @@ def test_agg_apply_evaluate_lambdas_the_same(string_series):
381381
def test_with_nested_series(datetime_series):
382382
# GH 2316
383383
# .agg with a reducer and a transform, what to do
384-
with tm.assert_produces_warning(FutureWarning, match="converting list of Series"):
384+
msg = "Returning a DataFrame from Series.apply when the supplied function"
385+
with tm.assert_produces_warning(FutureWarning, match=msg):
385386
# GH52123
386387
result = datetime_series.apply(
387388
lambda x: Series([x, x**2], index=["x", "x^2"])
388389
)
389390
expected = DataFrame({"x": datetime_series, "x^2": datetime_series**2})
390391
tm.assert_frame_equal(result, expected)
391392

392-
with tm.assert_produces_warning(FutureWarning, match="converting list of Series"):
393+
with tm.assert_produces_warning(FutureWarning, match=msg):
393394
# GH52123
394395
result = datetime_series.agg(lambda x: Series([x, x**2], index=["x", "x^2"]))
395396
tm.assert_frame_equal(result, expected)
@@ -863,7 +864,8 @@ def test_apply_series_on_date_time_index_aware_series(dti, exp, aware):
863864
index = dti.tz_localize("UTC").index
864865
else:
865866
index = dti.index
866-
with tm.assert_produces_warning(FutureWarning, match="converting list of Series"):
867+
msg = "Returning a DataFrame from Series.apply when the supplied function"
868+
with tm.assert_produces_warning(FutureWarning, match=msg):
867869
# GH52123
868870
result = Series(index).apply(lambda x: Series([1, 2]))
869871
tm.assert_frame_equal(result, exp)
@@ -975,7 +977,8 @@ def test_apply_retains_column_name():
975977
# GH 16380
976978
df = DataFrame({"x": range(3)}, Index(range(3), name="x"))
977979
func = lambda x: Series(range(x + 1), Index(range(x + 1), name="y"))
978-
with tm.assert_produces_warning(FutureWarning, match="converting list of Series"):
980+
msg = "Returning a DataFrame from Series.apply when the supplied function"
981+
with tm.assert_produces_warning(FutureWarning, match=msg):
979982
# GH52123
980983
result = df.x.apply(func)
981984
expected = DataFrame(

0 commit comments

Comments
 (0)