<s> import unittest <EOL> from openmdao . main . api import set_as_top <EOL> from openmdao . examples . enginedesign . engine_optimization_smarter import EngineOptimization <EOL> from openmdao . examples . enginedesign . vehicle_singlesim import VehicleSim <EOL> from openmdao . examples . enginedesign . vehicle_threesim import VehicleSim2 <EOL> class EngineOptimizationSmarterTestCase ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> self . model = set_as_top ( EngineOptimization ( ) ) <EOL> def tearDown ( self ) : <EOL> self . model . pre_delete ( ) <EOL> self . model = None <EOL> def test_runvehicle ( self ) : <EOL> self . model . vehicle . bore = <NUM_LIT:100> <EOL> self . model . vehicle . spark_angle = - <NUM_LIT> <EOL> self . model . driver . itmax = <NUM_LIT:1> <EOL> self . model . run ( ) <EOL> self . assertAlmostEqual ( self . model . sim_acc . accel_time , <EOL> <NUM_LIT> , places = <NUM_LIT:6> ) <EOL> self . assertAlmostEqual ( self . model . sim_EPA_city . fuel_economy , <EOL> <NUM_LIT> , places = <NUM_LIT:3> ) <EOL> self . assertAlmostEqual ( self . model . sim_EPA_highway . fuel_economy , <EOL> <NUM_LIT> , places = <NUM_LIT:4> ) <EOL> class SimVehicleScriptsTestCase ( unittest . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> pass <EOL> def tearDown ( self ) : <EOL> pass <EOL> def test_simvehicle_one ( self ) : <EOL> my_sim = VehicleSim ( ) <EOL> set_as_top ( my_sim ) <EOL> my_sim . run ( ) <EOL> self . assertAlmostEqual ( my_sim . driver . accel_time , <NUM_LIT> , places = <NUM_LIT:2> ) <EOL> def test_simvehicle_three ( self ) : <EOL> my_sim = VehicleSim2 ( ) <EOL> set_as_top ( my_sim ) <EOL> my_sim . run ( ) <EOL> self . assertAlmostEqual ( my_sim . sim_acc . accel_time , <NUM_LIT> , places = <NUM_LIT:2> ) <EOL> self . assertAlmostEqual ( my_sim . sim_EPA_city . fuel_economy , <NUM_LIT> , places = <NUM_LIT:2> ) <EOL> self . assertAlmostEqual ( my_sim . sim_EPA_highway . fuel_economy , <NUM_LIT> , places = <NUM_LIT:2> ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> import sys <EOL> if len ( sys . argv ) > <NUM_LIT:1> and sys . argv [ <NUM_LIT:1> ] == '<STR_LIT>' : <EOL> import cProfile <EOL> import pstats <EOL> sys . argv . remove ( '<STR_LIT>' ) <EOL> cProfile . run ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> p = pstats . Stats ( '<STR_LIT>' ) <EOL> p . strip_dirs ( ) <EOL> p . sort_stats ( '<STR_LIT>' , '<STR_LIT:time>' ) <EOL> p . print_stats ( ) <EOL> print '<STR_LIT>' <EOL> p . print_callers ( ) <EOL> print '<STR_LIT>' <EOL> p . print_callees ( ) <EOL> else : <EOL> unittest . main ( ) </s>
