#NEWLINE# def test_wait( self ) : #NEWLINE# #INDENT# b = wspbus . Bus ( ) #NEWLINE# def f( method ) : #NEWLINE# #INDENT# time . sleep ( 0.2 ) #NEWLINE# getattr ( b , method ) ( ) #NEWLINE# #UNINDENT# for ( method , states ) in [ ( 'start' , [ b . states . STARTED ] ) , ( 'stop' , [ b . states . STOPPED ] ) , ( 'start' , [ b . states . STARTING , b . states . STARTED ] ) , ( 'exit' , [ b . states . EXITING ] ) ] : #NEWLINE# #INDENT# threading . Thread ( target = f , args = ( method , ) ) . start ( ) #NEWLINE# b . wait ( states ) #NEWLINE# if ( b . state not in states ) : #NEWLINE# #INDENT# self . fail ( ( 'State %r not in %r' % ( b . state , states ) ) )