@@ -325,7 +325,7 @@ def f_missing(a, b):
325325    return  c 
326326
327327
328- def  f_check_param_definition (a , b , c , d ):
328+ def  f_check_param_definition (a , b , c , d ,  e ):
329329    """Function f 
330330
331331    Parameters 
@@ -338,6 +338,8 @@ def f_check_param_definition(a, b, c, d):
338338        Parameter c 
339339    d:int 
340340        Parameter d 
341+     e 
342+         No typespec is allowed without colon 
341343    """ 
342344    return  a  +  b  +  c  +  d 
343345
@@ -402,8 +404,8 @@ def predict(self, X):
402404        """ 
403405        return  self .delegate .predict (X )
404406
405-     @deprecated ("Testing a deprecated delegated method" ) 
406407    @if_delegate_has_method (delegate = ('delegate' )) 
408+     @deprecated ("Testing a deprecated delegated method" ) 
407409    def  score (self , X ):
408410        """This is available only if delegate has score. 
409411
@@ -424,20 +426,7 @@ def predict_proba(self, X):
424426        """ 
425427        return  X 
426428
427-     @deprecated ('Testing deprecated function with incorrect params' ) 
428-     @if_delegate_has_method (delegate = ('delegate' )) 
429-     def  predict_log_proba (self , X ):
430-         """This is available only if delegate has predict_proba. 
431- 
432-         Parameters 
433-         --------- 
434-         y : ndarray 
435-             Parameter X 
436-         """ 
437-         return  X 
438- 
439429    @deprecated ('Testing deprecated function with wrong params' ) 
440-     @if_delegate_has_method (delegate = ('delegate' )) 
441430    def  fit (self , X , y ):
442431        """Incorrect docstring but should not be tested""" 
443432
@@ -451,20 +440,32 @@ def test_check_docstring_parameters():
451440            "numpydoc is required to test the docstrings" )
452441
453442    incorrect  =  check_docstring_parameters (f_ok )
454-     assert_equal ( incorrect , []) 
443+     assert   incorrect   ==  [] 
455444    incorrect  =  check_docstring_parameters (f_ok , ignore = ['b' ])
456-     assert_equal ( incorrect , []) 
445+     assert   incorrect   ==  [] 
457446    incorrect  =  check_docstring_parameters (f_missing , ignore = ['b' ])
458-     assert_equal ( incorrect , []) 
447+     assert   incorrect   ==  [] 
459448    assert_raise_message (RuntimeError , 'Unknown section Results' ,
460449                         check_docstring_parameters , f_bad_sections )
461450    assert_raise_message (RuntimeError , 'Unknown section Parameter' ,
462451                         check_docstring_parameters , Klass .f_bad_sections )
463452
453+     incorrect  =  check_docstring_parameters (f_check_param_definition )
454+     assert  (
455+         incorrect  ==  [
456+             "sklearn.utils.tests.test_testing.f_check_param_definition There " 
457+             "was no space between the param name and colon ('a: int')" ,
458+             "sklearn.utils.tests.test_testing.f_check_param_definition There " 
459+             "was no space between the param name and colon ('b:')" ,
460+             "sklearn.utils.tests.test_testing.f_check_param_definition " 
461+             "Parameter 'c :' has an empty type spec. Remove the colon" ,
462+             "sklearn.utils.tests.test_testing.f_check_param_definition There " 
463+             "was no space between the param name and colon ('d:int')" ,
464+         ])
465+ 
464466    messages  =  ["a != b" , "arg mismatch: ['b']" , "arg mismatch: ['X', 'y']" ,
465467                "predict y != X" ,
466468                "predict_proba arg mismatch: ['X']" ,
467-                 "predict_log_proba arg mismatch: ['X']" ,
468469                "score arg mismatch: ['X']" ,
469470                ".fit arg mismatch: ['X', 'y']" ]
470471
@@ -473,21 +474,7 @@ def test_check_docstring_parameters():
473474    for  mess , f  in  zip (messages ,
474475                       [f_bad_order , f_missing , Klass .f_missing ,
475476                        mock_meta .predict , mock_meta .predict_proba ,
476-                         mock_meta .predict_log_proba ,
477477                        mock_meta .score , mock_meta .fit ]):
478478        incorrect  =  check_docstring_parameters (f )
479-         assert_true (len (incorrect ) >=  1 )
480-         assert_true (mess  in  incorrect [0 ],
481-                     '"%s" not in "%s"'  %  (mess , incorrect [0 ]))
482- 
483-     incorrect  =  check_docstring_parameters (f_check_param_definition )
484-     assert_equal (
485-         incorrect ,
486-         ['sklearn.utils.tests.test_testing.f_check_param_definition There was ' 
487-          'no space between the param name and colon ("a: int")' ,
488-          'sklearn.utils.tests.test_testing.f_check_param_definition There was ' 
489-          'no space between the param name and colon ("b:")' ,
490-          'sklearn.utils.tests.test_testing.f_check_param_definition Incorrect ' 
491-          'type definition for param: "c " (type definition was "")' ,
492-          'sklearn.utils.tests.test_testing.f_check_param_definition There was ' 
493-          'no space between the param name and colon ("d:int")' ])
479+         assert  len (incorrect ) >=  1 
480+         assert  mess  in  incorrect [0 ], '"%s" not in "%s"'  %  (mess , incorrect [0 ])
0 commit comments