<s> import unittest <EOL> from openmdao . main . api import Assembly , Component , set_as_top <EOL> from openmdao . main . datatypes . api import Float <EOL> class MyComp ( Component ) : <EOL> x = Float ( <NUM_LIT:1.0> , iotype = '<STR_LIT>' ) <EOL> y = Float ( iotype = '<STR_LIT>' ) <EOL> def execute ( self ) : <EOL> self . y = <NUM_LIT> * self . x <EOL> class Sub ( Assembly ) : <EOL> def configure ( self ) : <EOL> self . add ( '<STR_LIT:c>' , MyComp ( ) ) <EOL> self . driver . workflow . add ( [ '<STR_LIT:c>' ] ) <EOL> self . create_passthrough ( '<STR_LIT>' ) <EOL> self . create_passthrough ( '<STR_LIT>' ) <EOL> class Top ( Assembly ) : <EOL> def configure ( self ) : <EOL> self . add ( '<STR_LIT>' , Sub ( ) ) <EOL> self . add ( '<STR_LIT>' , MyComp ( ) ) <EOL> self . driver . workflow . add ( [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> self . connect ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> class InvalidationTestCase ( unittest . TestCase ) : <EOL> def test_assembly_input_invalidation ( self ) : <EOL> top = set_as_top ( Top ( ) ) <EOL> top . set ( '<STR_LIT>' , <NUM_LIT> ) <EOL> top . run ( ) <EOL> self . assertEqual ( top . sub . x , <NUM_LIT> ) <EOL> self . assertEqual ( top . comp . x , <NUM_LIT> ) <EOL> self . assertEqual ( top . comp . y , <NUM_LIT> ) <EOL> self . assertEqual ( top . sub . y , <NUM_LIT> ) <EOL> top . set ( '<STR_LIT>' , <NUM_LIT> ) <EOL> top . run ( ) <EOL> self . assertEqual ( top . sub . x , <NUM_LIT> ) <EOL> self . assertEqual ( top . comp . x , <NUM_LIT> ) <EOL> self . assertEqual ( top . comp . y , <NUM_LIT> ) <EOL> self . assertEqual ( top . sub . y , <NUM_LIT> ) </s>
