#NEWLINE# def test_registerAdapter_wo_explicit_provided( self ) : #NEWLINE# #INDENT# from zope.interface.declarations import InterfaceClass #NEWLINE# from zope.interface.declarations import implementer #NEWLINE# from zope.interface.interfaces import Registered #NEWLINE# from zope.interface.registry import AdapterRegistration #NEWLINE# from zope.interface._compat import _u #NEWLINE# class IFoo ( InterfaceClass ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# ifoo = IFoo ( 'IFoo' ) #NEWLINE# ibar = IFoo ( 'IBar' ) #NEWLINE# _info = _u ( 'info' ) #NEWLINE# _name = _u ( 'name' ) #NEWLINE# _to_reg = object ( ) #NEWLINE# @ implementer ( ifoo ) #NEWLINE# class _Factory ( object ) : #NEWLINE# #INDENT# def __init__( self , context ) : #NEWLINE# #INDENT# self . _context = context #NEWLINE# #UNINDENT# #UNINDENT# comp = self . _makeOne ( ) #NEWLINE# ( _monkey , _events ) = self . _wrapEvents ( ) #NEWLINE# with _monkey : #NEWLINE# #INDENT# comp . registerAdapter ( _Factory , ( ibar , ) , name = _name , info = _info ) #NEWLINE# #UNINDENT# self . failUnless ( ( comp . adapters . _adapters [ 1 ] [ ibar ] [ ifoo ] [ _name ] is _Factory ) ) #NEWLINE# self . assertEqual ( comp . _adapter_registrations [ ( ( ibar , ) , ifoo , _name ) ] , ( _Factory , _info ) ) #NEWLINE# self . assertEqual ( len ( _events ) , 1 ) #NEWLINE# ( args , kw ) = _events [ 0 ] #NEWLINE# ( event , ) = args #NEWLINE# self . assertEqual ( kw , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . failUnless ( isinstance ( event , Registered ) ) #NEWLINE# self . failUnless ( isinstance ( event . object , AdapterRegistration ) ) #NEWLINE# self . failUnless ( ( event . object . registry is comp ) ) #NEWLINE# self . failUnless ( ( event . object . provided is ifoo ) ) #NEWLINE# self . assertEqual ( event . object . required , ( ibar , ) ) #NEWLINE# self . failUnless ( ( ibar . object . name is _name ) ) #NEWLINE# self . failUnless ( ( event . object . info is _info ) ) #NEWLINE# self . failUnless ( ( event . object . factory is _Factory ) )