@@ -380,15 +380,16 @@ def test_agg_apply_evaluate_lambdas_the_same(string_series):
380380def test_with_nested_series (datetime_series ):
381381 # GH 2316
382382 # .agg with a reducer and a transform, what to do
383- with tm .assert_produces_warning (FutureWarning , match = "converting list of Series" ):
383+ msg = "Returning a DataFrame from Series.apply when the supplied function"
384+ with tm .assert_produces_warning (FutureWarning , match = msg ):
384385 # GH52123
385386 result = datetime_series .apply (
386387 lambda x : Series ([x , x ** 2 ], index = ["x" , "x^2" ])
387388 )
388389 expected = DataFrame ({"x" : datetime_series , "x^2" : datetime_series ** 2 })
389390 tm .assert_frame_equal (result , expected )
390391
391- with tm .assert_produces_warning (FutureWarning , match = "converting list of Series" ):
392+ with tm .assert_produces_warning (FutureWarning , match = msg ):
392393 # GH52123
393394 result = datetime_series .agg (lambda x : Series ([x , x ** 2 ], index = ["x" , "x^2" ]))
394395 tm .assert_frame_equal (result , expected )
@@ -836,7 +837,8 @@ def test_apply_series_on_date_time_index_aware_series(dti, exp, aware):
836837 index = dti .tz_localize ("UTC" ).index
837838 else :
838839 index = dti .index
839- with tm .assert_produces_warning (FutureWarning , match = "converting list of Series" ):
840+ msg = "Returning a DataFrame from Series.apply when the supplied function"
841+ with tm .assert_produces_warning (FutureWarning , match = msg ):
840842 # GH52123
841843 result = Series (index ).apply (lambda x : Series ([1 , 2 ]))
842844 tm .assert_frame_equal (result , exp )
@@ -948,7 +950,8 @@ def test_apply_retains_column_name():
948950 # GH 16380
949951 df = DataFrame ({"x" : range (3 )}, Index (range (3 ), name = "x" ))
950952 func = lambda x : Series (range (x + 1 ), Index (range (x + 1 ), name = "y" ))
951- with tm .assert_produces_warning (FutureWarning , match = "converting list of Series" ):
953+ msg = "Returning a DataFrame from Series.apply when the supplied function"
954+ with tm .assert_produces_warning (FutureWarning , match = msg ):
952955 # GH52123
953956 result = df .x .apply (func )
954957 expected = DataFrame (
0 commit comments