#NEWLINE# def assertWrapperExceptionTypes( self , deferred , mainType , reasonTypes ) : #NEWLINE# #INDENT# "\n    Assert that the given L{Deferred} fails with the exception given by\n    C{mainType} and that the exceptions wrapped by the instance of C{mainType}\n    it fails with match the list of exception types given by C{reasonTypes}.\n\n    This is a helper for testing failures of exceptions which subclass\n    L{_newclient._WrapperException}.\n\n    @param self: A L{TestCase} instance which will be used to make the\n        assertions.\n\n    @param deferred: The L{Deferred} which is expected to fail with\n        C{mainType}.\n\n    @param mainType: A L{_newclient._WrapperException} subclass which will be\n        trapped on C{deferred}.\n\n    @param reasonTypes: A sequence of exception types which will be trapped on\n        the resulting C{mainType} exception instance's C{reasons} sequence.\n\n    @return: A L{Deferred} which fires with the C{mainType} instance\n        C{deferred} fails with, or which fails somehow.\n    " #NEWLINE# def cbFailed( err ) : #NEWLINE# #INDENT# for ( reason , type ) in zip ( err . reasons , reasonTypes ) : #NEWLINE# #INDENT# reason . trap ( type ) #NEWLINE# #UNINDENT# self . assertEqual ( len ( err . reasons ) , len ( reasonTypes ) , ( 'len(%s) != len(%s)' % ( err . reasons , reasonTypes ) ) ) #NEWLINE# return err #NEWLINE# #UNINDENT# d = self . assertFailure ( deferred , mainType ) #NEWLINE# d . addCallback ( cbFailed ) #NEWLINE# return d