#NEWLINE# def test_check_is_fitted( ) : #NEWLINE# #INDENT# assert_raises ( ValueError , check_is_fitted , ARDRegression , 'coef_' ) #NEWLINE# assert_raises ( TypeError , check_is_fitted , 'SVR' , 'support_' ) #NEWLINE# ard = ARDRegression ( ) #NEWLINE# svr = SVR ( ) #NEWLINE# try : #NEWLINE# #INDENT# assert_raises ( NotFittedError , check_is_fitted , ard , 'coef_' ) #NEWLINE# assert_raises ( NotFittedError , check_is_fitted , svr , 'support_' ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# assert False , 'check_is_fitted failed with ValueError' #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# check_is_fitted ( ard , 'coef_' , 'Random message %(name)s, %(name)s' ) #NEWLINE# #UNINDENT# except ValueError as e : #NEWLINE# #INDENT# assert_equal ( str ( e ) , 'Random message ARDRegression, ARDRegression' ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# check_is_fitted ( svr , 'support_' , 'Another message %(name)s, %(name)s' ) #NEWLINE# #UNINDENT# except AttributeError as e : #NEWLINE# #INDENT# assert_equal ( str ( e ) , 'Another message SVR, SVR' ) #NEWLINE# #UNINDENT# ard . fit ( * make_blobs ( ) ) #NEWLINE# svr . fit ( * make_blobs ( ) ) #NEWLINE# assert_equal ( None , check_is_fitted ( ard , 'coef_' ) ) #NEWLINE# assert_equal ( None , check_is_fitted ( svr , 'support_' ) )