#NEWLINE# def test_deferredErrback( self ) : #NEWLINE# #INDENT# "\n        If the function called by L{utils.runWithWarningsSuppressed} returns a\n        C{Deferred}, the warning filters aren't removed until the Deferred\n        fires with an errback.\n        " #NEWLINE# filters = [ ( ( 'ignore' , '.*foo.*' ) , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) , ( ( 'ignore' , '.*bar.*' ) , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ] #NEWLINE# result = Deferred ( ) #NEWLINE# d = self . runWithWarningsSuppressed ( filters , ( lambda : result ) ) #NEWLINE# warnings . warn ( 'ignore foo' ) #NEWLINE# result . errback ( ZeroDivisionError ( ) ) #NEWLINE# d . addErrback ( ( lambda f : f . trap ( ZeroDivisionError ) ) ) #NEWLINE# warnings . warn ( 'ignore foo 2' ) #NEWLINE# self . assertEqual ( [ 'ignore foo 2' ] , [ w [ 'message' ] for w in self . flushWarnings ( ) ] )