#NEWLINE# def testSimple( self ) : #NEWLINE# #INDENT# 'Tests simple waiting.' #NEWLINE# self . worker . start ( ) #NEWLINE# one = timer_worker . TimerItem ( 0.8 ) #NEWLINE# two = timer_worker . TimerItem ( 0.5 ) #NEWLINE# three = timer_worker . TimerItem ( 0.1 ) #NEWLINE# begin = time . time ( ) #NEWLINE# self . timer_queue . put ( one ) #NEWLINE# time . sleep ( 0.2 ) #NEWLINE# self . timer_queue . put ( two ) #NEWLINE# time . sleep ( 0.2 ) #NEWLINE# self . timer_queue . put ( three ) #NEWLINE# time . sleep ( 0.2 ) #NEWLINE# output_three = self . output_queue . get ( ) #NEWLINE# time . sleep ( 0.1 ) #NEWLINE# output_two = self . output_queue . get ( ) #NEWLINE# output_one = self . output_queue . get ( ) #NEWLINE# end = time . time ( ) #NEWLINE# self . assertEquals ( one . delay_seconds , output_one . delay_seconds ) #NEWLINE# self . assertEquals ( two . delay_seconds , end . delay_seconds ) #NEWLINE# self . assertEquals ( three . delay_seconds , output_three . delay_seconds ) #NEWLINE# elapsed = ( end - begin ) #NEWLINE# self . assertTrue ( ( 1.0 > elapsed > 0.7 ) )