[Subversion] / PEAK / src / peak / config / tests / __init__.py  

Diff of /PEAK/src/peak/config/tests/__init__.py

Parent Directory | Revision Log

version 1573, Sun Dec 28 00:14:24 2003 UTC version 1574, Sun Dec 28 03:52:01 2003 UTC
Line 5 
Line 5 
 from protocols import Interface  from protocols import Interface
 from peak.config.interfaces import *  from peak.config.interfaces import *
 from peak.tests import testRoot  from peak.tests import testRoot
 from peak.config.registries import EigenRegistry  from peak.config.registries import ImmutableConfig
   
   
 def makeAUtility(context):  def makeAUtility(context):
Line 216 
Line 216 
 class ID(IB): pass  class ID(IB): pass
   
   
 class PA(object): __implements__ = IA,  class PA(object): ifaces = IA,
 class PB(object): __implements__ = IB,  class PB(object): ifaces = IB,
 class PC(object): __implements__ = IC,  class PC(object): ifaces = IC,
 class PD(object): __implements__ = ID,  class PD(object): ifaces = ID,
 class PE(object): __implements__ = IC, ID  class PE(object): ifaces = IC, ID
   
   
 pA = PA()  pA = PA()
Line 236 
Line 236 
   
     def setUp(self):      def setUp(self):
   
         reg = self.reg = EigenRegistry()          reg = self.reg = ImmutableConfig(
               items=[(i,ob) for ob in self.obs for i in ob.ifaces]
           )
   
   
         for ob in self.obs:  
             for i in ob.__implements__:  
                 reg.register(i, ob)  
   
   
   
Line 250 
Line 250 
   
         reg = self.reg          reg = self.reg
   
         assert reg[IA] is pA          assert reg.lookup(adapt(IA,IConfigKey)) is pA
         assert reg[IB] is pB          assert reg.lookup(adapt(IB,IConfigKey)) is pB
         assert reg[IC] is pE    # Note changed behavior; now the latest wins          assert reg.lookup(adapt(IC,IConfigKey)) is pE    # latest wins
         assert reg[ID] is pE    # ...same here          assert reg.lookup(adapt(ID,IConfigKey)) is pE    # ...same here
   
   
 class RegBackward(RegForward):  class RegBackward(RegForward):
Line 268 
Line 268 
   
     def checkUpdate(self):      def checkUpdate(self):
   
         reg1 = EigenRegistry()          reg1 = ImmutableConfig(items=[(IA,pA)])
         reg2 = EigenRegistry()          reg2 = ImmutableConfig(items=[(IB,pB)])
   
           assert reg1.lookup(adapt(IA,IConfigKey)) is pA
           assert reg2.lookup(adapt(IA,IConfigKey)) is pB
   
           reg3 = ImmutableConfig([reg1,reg2])
   
         reg1.register(IA,pA)          assert reg3.lookup(adapt(IA,IConfigKey)) is pA
         reg2.register(IB,pB)          assert reg3.lookup(adapt(IB,IConfigKey)) is pB
   
         assert reg1[IA] is pA  
         assert reg2[IA] is pB  
   
         reg1.update(reg2)  
   
         assert reg1[IA] is pA  
         assert reg1[IB] is pB  
   
   
   


Generate output suitable for use with a patch program
Legend:
Removed from v.1573  
changed lines
  Added in v.1574

cvs-admin@eby-sarna.com

Powered by ViewCVS 1.0-dev

ViewCVS and CVS Help