@@ -6209,6 +6209,34 @@ def test_convert_objects(self):
62096209 result = s .convert_objects (datetime = True , coerce = True )
62106210 assert_series_equal (result , expected )
62116211
6212+ # GH 10601
6213+ # Remove test after deprecation to convert_objects is final
6214+ def test_convert_objects_old_style_deprecation (self ):
6215+ s = Series (['foo' , 'bar' , 1 , 1.0 ], dtype = 'O' )
6216+ with warnings .catch_warnings (record = True ) as w :
6217+ warnings .simplefilter ('always' , FutureWarning )
6218+ new_style = s .convert_objects (datetime = True , coerce = True )
6219+ old_style = s .convert_objects (convert_dates = 'coerce' )
6220+ self .assertEqual (len (w ), 2 )
6221+ assert_series_equal (new_style , old_style )
6222+
6223+ with warnings .catch_warnings (record = True ) as w :
6224+ warnings .simplefilter ('always' , FutureWarning )
6225+ new_style = s .convert_objects (numeric = True , coerce = True )
6226+ old_style = s .convert_objects (convert_numeric = 'coerce' )
6227+ self .assertEqual (len (w ), 2 )
6228+ assert_series_equal (new_style , old_style )
6229+
6230+ dt = datetime (2001 , 1 , 1 , 0 , 0 )
6231+ td = dt - datetime (2000 , 1 , 1 , 0 , 0 )
6232+ s = Series (['a' , '3.1415' , dt , td ])
6233+ with warnings .catch_warnings (record = True ) as w :
6234+ warnings .simplefilter ('always' , FutureWarning )
6235+ new_style = s .convert_objects (timedelta = True , coerce = True )
6236+ old_style = s .convert_objects (convert_timedeltas = 'coerce' )
6237+ self .assertEqual (len (w ), 2 )
6238+ assert_series_equal (new_style , old_style )
6239+
62126240 def test_convert_objects_no_arg_warning (self ):
62136241 s = Series (['1.0' ,'2' ])
62146242 with warnings .catch_warnings (record = True ) as w :
0 commit comments