@@ -6469,6 +6469,34 @@ def test_convert_objects(self):
64696469 result = s .convert_objects (datetime = True , coerce = True )
64706470 assert_series_equal (result , expected )
64716471
6472+ # GH 10601
6473+ # Remove test after deprecation to convert_objects is final
6474+ def test_convert_objects_old_style_deprecation (self ):
6475+ s = Series (['foo' , 'bar' , 1 , 1.0 ], dtype = 'O' )
6476+ with warnings .catch_warnings (record = True ) as w :
6477+ warnings .simplefilter ('always' , FutureWarning )
6478+ new_style = s .convert_objects (datetime = True , coerce = True )
6479+ old_style = s .convert_objects (convert_dates = 'coerce' )
6480+ self .assertEqual (len (w ), 2 )
6481+ assert_series_equal (new_style , old_style )
6482+
6483+ with warnings .catch_warnings (record = True ) as w :
6484+ warnings .simplefilter ('always' , FutureWarning )
6485+ new_style = s .convert_objects (numeric = True , coerce = True )
6486+ old_style = s .convert_objects (convert_numeric = 'coerce' )
6487+ self .assertEqual (len (w ), 2 )
6488+ assert_series_equal (new_style , old_style )
6489+
6490+ dt = datetime (2001 , 1 , 1 , 0 , 0 )
6491+ td = dt - datetime (2000 , 1 , 1 , 0 , 0 )
6492+ s = Series (['a' , '3.1415' , dt , td ])
6493+ with warnings .catch_warnings (record = True ) as w :
6494+ warnings .simplefilter ('always' , FutureWarning )
6495+ new_style = s .convert_objects (timedelta = True , coerce = True )
6496+ old_style = s .convert_objects (convert_timedeltas = 'coerce' )
6497+ self .assertEqual (len (w ), 2 )
6498+ assert_series_equal (new_style , old_style )
6499+
64726500 def test_convert_objects_no_arg_warning (self ):
64736501 s = Series (['1.0' ,'2' ])
64746502 with warnings .catch_warnings (record = True ) as w :
0 commit comments