#NEWLINE# def test_unregisterAdapter_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 Unregistered #NEWLINE# from zope.interface.registry import AdapterRegistration #NEWLINE# class IFoo ( InterfaceClass ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# ifoo = IFoo ( 'IFoo' ) #NEWLINE# ibar = IFoo ( 'IBar' ) #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# comp . registerAdapter ( _Factory , ( ibar , ) , ifoo ) #NEWLINE# ( _monkey , _events ) = self . _wrapEvents ( ) #NEWLINE# with _monkey : #NEWLINE# #INDENT# unreg = comp . unregisterAdapter ( _Factory , ( ibar , ) ) #NEWLINE# #UNINDENT# self . failUnless ( unreg ) #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 , Unregistered ) ) #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 . assertEqual ( event . object . name , '' ) #NEWLINE# self . assertEqual ( event . object . info , '' ) #NEWLINE# self . failUnless ( ( event . object . factory is _Factory ) )