#NEWLINE# def test_getAdapter_hit( self ) : #NEWLINE# #INDENT# from zope.interface.declarations import InterfaceClass #NEWLINE# from zope.interface.declarations import implementer #NEWLINE# class IFoo ( InterfaceClass ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# ifoo = IFoo ( 'IFoo' ) #NEWLINE# ibar = IFoo ( 'IBar' ) #NEWLINE# class _Factory ( object ) : #NEWLINE# #INDENT# def __init__( self , context ) : #NEWLINE# #INDENT# self . context = context #NEWLINE# #UNINDENT# #UNINDENT# @ implementer ( ibar ) #NEWLINE# class _Context ( object ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# _context = _Context ( ) #NEWLINE# comp = self . _makeOne ( ) #NEWLINE# comp . registerAdapter ( _Factory , ( ibar , ) , ifoo ) #NEWLINE# adapter = comp . getAdapter ( _context , ifoo ) #NEWLINE# self . failUnless ( isinstance ( adapter , _Factory ) ) #NEWLINE# self . failUnless ( ( adapter . context is _context ) )