#NEWLINE# def test_uninitialized_array( self ) : #NEWLINE# #INDENT# expected = ': out1.x was not initialized. OpenMDAO does not support uninitialized variables.' #NEWLINE# '\n        out1.x is:\n            - uninitialized\n            - flattenable\n            - the source of a connection\n            - not a slice\n        ' #NEWLINE# top = set_as_top ( Assembly ( ) ) #NEWLINE# top . add ( 'out1' , self . C1 ( ) ) #NEWLINE# top . add ( 'in1' , self . C2 ( ) ) #NEWLINE# top . connect ( 'out1.x' , 'in1.x' ) #NEWLINE# top . driver . workflow . add ( [ 'out1' , 'in1' ] ) #NEWLINE# try : #NEWLINE# #INDENT# top . run ( ) #NEWLINE# #UNINDENT# except ValueError as e : #NEWLINE# #INDENT# self . assertEqual ( str ( e ) , expected ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . fail ( 'Should have raised error message: {}' . format ( expected ) ) #NEWLINE# #UNINDENT# '\n        out1.x is:\n            - uninitialized\n            - not flattenable\n            - the source of a connection\n            - not a slice\n        ' #NEWLINE# top = set_as_top ( Assembly ( ) ) #NEWLINE# top . add ( 'out1' , self . C3 ( ) ) #NEWLINE# top . add ( 'in1' , self . C2 ( ) ) #NEWLINE# top . connect ( 'out1.x' , 'in1.x' ) #NEWLINE# top . driver . workflow . add ( [ 'out1' , 'in1' ] ) #NEWLINE# top . run ( ) #NEWLINE# '\n        out1.x is:\n            - initialized\n            - flattenable\n            - the source of a connection\n            - not a slice\n        ' #NEWLINE# top = set_as_top ( Assembly ( ) ) #NEWLINE# top . add ( 'out1' , self . C4 ( np . eye ( 2 ) ) ) #NEWLINE# top . add ( 'in1' , self . C2 ( ) ) #NEWLINE# top . connect ( 'out1.x' , 'in1.x' ) #NEWLINE# top . driver . workflow . add ( [ 'out1' , 'in1' ] ) #NEWLINE# top . run ( ) #NEWLINE# '\n        out1.x is:\n            - initialized\n            - flattenable\n            - the source of a connection\n            - not a slice\n\n        in1.x[::1] is:\n            - initialized\n            - flattenable\n            - the source of a connection\n            - a slice\n        ' #NEWLINE# top = set_as_top ( Assembly ( ) ) #NEWLINE# top . add ( 'out1' , self . C4 ( np . array ( range ( 5 ) ) ) ) #NEWLINE# top . add ( 'in1' , self . C2 ( ) ) #NEWLINE# top . add ( 'in2' , self . C2 ( ) ) #NEWLINE# top . connect ( 'out1.x' , 'in1.x' ) #NEWLINE# top . connect ( 'in1.x[::1]' , 'in2.x' ) #NEWLINE# top . driver . workflow . add ( [ 'out1' , 'in1' , 'in2' ] ) #NEWLINE# top . run ( ) #NEWLINE# '\n        sub.out1.x is:\n            - not initialized\n            - flattenable\n            - source of a connection\n            - not a slice\n        ' #NEWLINE# expected = 'sub: out1.x was not initialized. OpenMDAO does not support uninitialized variables.' #NEWLINE# top = set_as_top ( Assembly ( ) ) #NEWLINE# top . add ( 'sub' , Assembly ( ) ) #NEWLINE# top . sub . add ( 'out1' , self . C1 ( ) ) #NEWLINE# top . sub . add ( 'in1' , self . C2 ( ) ) #NEWLINE# top . sub . connect ( 'out1.x' , 'in1.x' ) #NEWLINE# top . sub . driver . workflow . add ( [ 'out1' , 'in1' ] ) #NEWLINE# top . driver . workflow . add ( [ 'sub' ] ) #NEWLINE# try : #NEWLINE# #INDENT# top . run ( ) #NEWLINE# #UNINDENT# except ValueError as e : #NEWLINE# #INDENT# self . assertEqual ( str ( e ) , expected ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . fail ( 'Should have raised error message: {}' . format ( expected ) )