#NEWLINE# def test_registeredAdapters_notempty( self ) : #NEWLINE# #INDENT# from zope.interface.declarations import InterfaceClass #NEWLINE# from zope.interface._compat import _u #NEWLINE# from zope.interface.registry import AdapterRegistration #NEWLINE# class IFoo ( InterfaceClass ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# ifoo = IFoo ( 'IFoo' ) #NEWLINE# ibar = IFoo ( 'IFoo' ) #NEWLINE# _info = _u ( 'info' ) #NEWLINE# _name1 = _u ( 'name1' ) #NEWLINE# _name2 = _u ( 'name2' ) #NEWLINE# class _Factory ( object ) : #NEWLINE# #INDENT# def __init__( self , context ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# comp = self . _makeOne ( ) #NEWLINE# comp . registerAdapter ( _Factory , ( ibar , ) , ifoo , _name1 , _info ) #NEWLINE# comp . registerAdapter ( _Factory , ( ibar , ) , ifoo , _name2 , _info ) #NEWLINE# reg = list ( comp . registeredAdapters ( ) ) #NEWLINE# self . assertEqual ( len ( reg ) , 2 ) #NEWLINE# self . failUnless ( isinstance ( reg [ 0 ] , AdapterRegistration ) ) #NEWLINE# self . failUnless ( ( reg [ 0 ] . registry is comp ) ) #NEWLINE# self . failUnless ( ( reg [ 0 ] . provided is ifoo ) ) #NEWLINE# self . assertEqual ( reg [ 0 ] . required , ( ibar , ) ) #NEWLINE# self . failUnless ( ( reg [ 0 ] . name is _name1 ) ) #NEWLINE# self . failUnless ( ( reg [ 0 ] . info is _info ) ) #NEWLINE# self . failUnless ( ( reg [ 0 ] . factory is _Factory ) ) #NEWLINE# self . failUnless ( isinstance ( reg [ 1 ] , AdapterRegistration ) ) #NEWLINE# self . failUnless ( ( reg [ 1 ] . registry is comp ) ) #NEWLINE# self . failUnless ( ( reg [ 1 ] . provided is ifoo ) ) #NEWLINE# self . assertEqual ( reg [ 1 ] . required , ( comp , ) ) #NEWLINE# self . failUnless ( ( reg [ 1 ] . name is _name2 ) ) #NEWLINE# self . failUnless ( ( reg [ 1 ] . info is _info ) ) #NEWLINE# self . failUnless ( ( reg [ 1 ] . factory is _Factory ) )