#NEWLINE# def test_waitfor( self ) : #NEWLINE# #INDENT# cond = self . condtype ( ) #NEWLINE# state = 0 #NEWLINE# def f( ) : #NEWLINE# #INDENT# with cond : #NEWLINE# #INDENT# result = cond . wait_for ( ( lambda : ( state == 4 ) ) ) #NEWLINE# self . assertTrue ( result ) #NEWLINE# self . assertEqual ( state , 4 ) #NEWLINE# #UNINDENT# #UNINDENT# b = Bunch ( f , 1 ) #NEWLINE# b . wait_for_started ( ) #NEWLINE# for i in range ( 4 ) : #NEWLINE# #INDENT# time . sleep ( 0.01 ) #NEWLINE# with cond : #NEWLINE# #INDENT# state += 1 #NEWLINE# cond . notify ( ) #NEWLINE# #UNINDENT# #UNINDENT# b . wait_for_finished ( )