#NEWLINE# def _check_notify( self , cond ) : #NEWLINE# #INDENT# N = 5 #NEWLINE# results1 = [ ] #NEWLINE# results2 = [ ] #NEWLINE# phase_num = 0 #NEWLINE# def f( ) : #NEWLINE# #INDENT# cond . acquire ( ) #NEWLINE# result = cond . wait ( ) #NEWLINE# cond . release ( ) #NEWLINE# results1 . append ( ( result , phase_num ) ) #NEWLINE# cond . acquire ( ) #NEWLINE# result = cond . wait ( ) #NEWLINE# cond . release ( ) #NEWLINE# results2 . append ( ( result , phase_num ) ) #NEWLINE# #UNINDENT# b = Bunch ( f , N ) #NEWLINE# b . wait_for_started ( ) #NEWLINE# _wait ( ) #NEWLINE# self . assertEqual ( results1 , [ ] ) #NEWLINE# cond . acquire ( ) #NEWLINE# cond . notify ( 3 ) #NEWLINE# _wait ( ) #NEWLINE# phase_num = 1 #NEWLINE# cond . release ( ) #NEWLINE# while ( len ( results1 ) < 3 ) : #NEWLINE# #INDENT# _wait ( ) #NEWLINE# #UNINDENT# self . assertEqual ( results1 , ( [ ( True , 1 ) ] * 3 ) ) #NEWLINE# self . assertEqual ( results2 , [ ] ) #NEWLINE# cond . acquire ( ) #NEWLINE# cond . notify ( 5 ) #NEWLINE# _wait ( ) #NEWLINE# phase_num = 2 #NEWLINE# cond . release ( ) #NEWLINE# while ( ( len ( results1 ) + len ( cond ) ) < 8 ) : #NEWLINE# #INDENT# _wait ( ) #NEWLINE# #UNINDENT# self . assertEqual ( results1 , ( ( [ ( True , 1 ) ] * 3 ) + ( [ ( True , 2 ) ] * 2 ) ) ) #NEWLINE# self . assertEqual ( results2 , ( [ ( True , 2 ) ] * 3 ) ) #NEWLINE# cond . acquire ( ) #NEWLINE# cond . notify_all ( ) #NEWLINE# _wait ( ) #NEWLINE# phase_num = 3 #NEWLINE# cond . release ( ) #NEWLINE# while ( len ( results2 ) < 5 ) : #NEWLINE# #INDENT# _wait ( ) #NEWLINE# #UNINDENT# self . assertEqual ( results1 , ( ( [ ( True , 1 ) ] * 3 ) + ( [ ( True , 2 ) ] * 2 ) ) ) #NEWLINE# self . assertEqual ( results2 , ( ( [ ( True , 2 ) ] * 3 ) + ( [ ( True , 3 ) ] * 2 ) ) ) #NEWLINE# b . wait_for_finished ( )