#NEWLINE# def test_whenDoneError( self ) : #NEWLINE# #INDENT# "\n        L{CooperativeTask.whenDone} returns a L{defer.Deferred} that will fail\n        when the iterable's C{next} method raises an exception, with that\n        exception.\n        " #NEWLINE# deferred1 = self . task . whenDone ( ) #NEWLINE# results = [ ] #NEWLINE# deferred1 . addErrback ( results . append ) #NEWLINE# self . dieNext ( ) #NEWLINE# self . scheduler . pump ( ) #NEWLINE# self . assertEqual ( len ( results ) , 1 ) #NEWLINE# self . assertEqual ( results [ 0 ] . check ( UnhandledException ) , UnhandledException )