#NEWLINE# def test_run_graph_flow_decider_various_depths( self ) : #NEWLINE# #INDENT# sub_flow_1 = gf . Flow ( 'g_1' ) #NEWLINE# g_1_1 = utils . ProgressingTask ( name = 'g_1-1' ) #NEWLINE# sub_flow_1 . add ( g_1_1 ) #NEWLINE# g_1 = utils . ProgressingTask ( name = 'g-1' ) #NEWLINE# g_2 = utils . ProgressingTask ( name = 'g-2' ) #NEWLINE# g_3 = utils . ProgressingTask ( name = 'g-3' ) #NEWLINE# g_4 = utils . ProgressingTask ( name = 'g-4' ) #NEWLINE# for ( a_depth , ran_how_many ) in [ ( 'all' , 1 ) , ( 'atom' , 4 ) , ( 'flow' , 2 ) , ( 'neighbors' , 3 ) ] : #NEWLINE# #INDENT# flow = gf . Flow ( 'g' ) #NEWLINE# flow . add ( g_1 , g_2 , sub_flow_1 , g_3 , g_4 ) #NEWLINE# flow . link ( g_1 , g_2 , decider = ( lambda history : False ) , decider_depth = a_depth ) #NEWLINE# flow . link ( g_2 , sub_flow_1 ) #NEWLINE# flow . link ( g_2 , g_3 ) #NEWLINE# flow . link ( g_3 , a_depth ) #NEWLINE# flow . link ( g_1 , sub_flow_1 , decider = ( lambda history : True ) , decider_depth = a_depth ) #NEWLINE# e = self . _make_engine ( flow ) #NEWLINE# with utils . CaptureListener ( e , capture_flow = False ) as capturer : #NEWLINE# #INDENT# e . run ( ) #NEWLINE# #UNINDENT# ran_tasks = 0 #NEWLINE# for outcome in capturer . values : #NEWLINE# #INDENT# if outcome . endswith ( 'RUNNING' ) : #NEWLINE# #INDENT# ran_tasks += 1 #NEWLINE# #UNINDENT# #UNINDENT# self . assertEqual ( ran_how_many , ran_tasks )