#NEWLINE# def testResourceExhaustion( self ) : #NEWLINE# #INDENT# output = [ ] #NEWLINE# def myiter( ) : #NEWLINE# #INDENT# for i in range ( 100 ) : #NEWLINE# #INDENT# output . append ( i ) #NEWLINE# if ( i == 9 ) : #NEWLINE# #INDENT# _TPF . stopped = True #NEWLINE# #UNINDENT# ( yield i ) #NEWLINE# #UNINDENT# #UNINDENT# class _TPF ( ) : #NEWLINE# #INDENT# stopped = False #NEWLINE# def __call__( self ) : #NEWLINE# #INDENT# return self . stopped #NEWLINE# #UNINDENT# #UNINDENT# c = task . Cooperator ( terminationPredicateFactory = _TPF ) #NEWLINE# c . coiterate ( myiter ( ) ) . addErrback ( self . ebIter ) #NEWLINE# c . _delayedCall . cancel ( ) #NEWLINE# c . _tick ( ) #NEWLINE# c . stop ( ) #NEWLINE# self . assertTrue ( _TPF . stopped ) #NEWLINE# self . assertEqual ( self , list ( range ( 10 ) ) )