#NEWLINE# def test_index_error_messages_param( self ) : #NEWLINE# #INDENT# prob = Problem ( ) #NEWLINE# prob . root = Group ( ) #NEWLINE# prob . root . fd_options [ 'force_fd' ] = True #NEWLINE# prob . root . ln_solver . options [ 'mode' ] = 'auto' #NEWLINE# prob . root . add ( 'myparams' , IndepVarComp ( 'x' , np . zeros ( 4 ) ) ) #NEWLINE# prob . root . add ( 'rosen' , Rosenbrock ( 4 ) ) #NEWLINE# prob . root . connect ( 'myparams.x' , 'rosen.x' ) #NEWLINE# prob . driver = MySimpleDriver ( ) #NEWLINE# prob . driver . add_desvar ( 'myparams.x' , indices = [ 0 , 3 , 4 ] ) #NEWLINE# prob . driver . add_objective ( 'rosen.f' ) #NEWLINE# prob . setup ( check = False ) #NEWLINE# with self . assertRaises ( IndexError ) as cm : #NEWLINE# #INDENT# prob . run ( ) #NEWLINE# #UNINDENT# msg = "Index for design var 'myparams.x' is out of bounds. " #NEWLINE# msg += 'Requested index: [0 3 4], ' #NEWLINE# msg += 'shape: (4,).' #NEWLINE# raised_error = str ( prob . exception ) #NEWLINE# raised_error = raised_error . replace ( '(4L,' , '(4,' ) #NEWLINE# self . assertEqual ( msg , raised_error )