3 ,Wg@sDdZddlZGdddejZGdddejZddZd d ZdS) zTests for z.c.hooks Nc@sfeZdZddZddZddZddZdd d Zd d ZddZ ddZ ddZ ddZ ddZ dS)PersistentAdapterRegistryTestscCsddlm}|S)Nr)PersistentAdapterRegistry)!zope.component.persistentregistryr)selfrr-/usr/lib/python3.6/test_persistentregistry.py_getTargetClasss z.PersistentAdapterRegistryTests._getTargetClasscOs|j||S)N)r)rargskwrrr_makeOnesz'PersistentAdapterRegistryTests._makeOnecCsGdddt}||S)Nc@s,eZdZddZddZddZddZd S) z9PersistentAdapterRegistryTests._makeCache.._CachecSs||_g|_dS)N)_jar_mru)rjarrrr__init__ szBPersistentAdapterRegistryTests._makeCache.._Cache.__init__cSs|jj|dS)N)r append)roidrrrmru#sz=PersistentAdapterRegistryTests._makeCache.._Cache.mrucSs|j|_||_dS)N)r Z_p_jar_p_oid)rrobjrrr new_ghost%szCPersistentAdapterRegistryTests._makeCache.._Cache.new_ghostcSsdS)Nr)rrsizerrrupdate_object_size_estimation(szWPersistentAdapterRegistryTests._makeCache.._Cache.update_object_size_estimationN)__name__ __module__ __qualname__rrrrrrrr_Cachesr)object)rrrrrr _makeCaches z)PersistentAdapterRegistryTests._makeCachecCsFddlm}ddlm}||Gdddt}|}|j||_|S)Nr) implementer)IPersistentDataManagerc@s$eZdZddZddZddZdS)z5PersistentAdapterRegistryTests._makeJar.._JarcSsg|_g|_dS)N)_loaded _registered)rrrrr4sz>PersistentAdapterRegistryTests._makeJar.._Jar.__init__cSs|jj|jdS)N)r rr)rrrrrsetstate7sz>PersistentAdapterRegistryTests._makeJar.._Jar.setstatecSs|jj|jdS)N)r!rr)rrrrrregister9sz>PersistentAdapterRegistryTests._makeJar.._Jar.registerN)rrrrr"r#rrrr_Jar2sr$)Zzope.interfacerZpersistent.interfacesrrr_cache)rrrr$rrrr_makeJar-s    z'PersistentAdapterRegistryTests._makeJarFcKs4td}|jf|}|j}|jj|||||fS)Nz) _makeOctetsr r&r%r)rZdirtyr OIDZinstrrrr_makeOneWithJar@s  z.PersistentAdapterRegistryTests._makeOneWithJarcCsH|j\}}}|j|jd|jt|j|jd|j|jddS)NT)r+ assertEqual _generationchangedr _p_changed)rregistryrr*rrrtest_changed_original_is_not_usHs  z>PersistentAdapterRegistryTests.test_changed_original_is_not_uscCsF|j\}}}|j|jd|j||j|jd|j|jddS)Nr,Tr-)r+r.r/r0r1)rr2rr*rrrtest_changed_original_is_usRs  z:PersistentAdapterRegistryTests.test_changed_original_is_uscCsddlm}|j|jf}|j|d\}}}|j}|j|d||j|dd|j|di|j|dg|j|d g|jd |kdS) Nr)globalSiteManager)bases __bases__r/r,Z _providedZ _adaptersZ _subscribersro)zope.componentr5adapters utilitiesr+ __getstate__r. assertFalse)rr5r6r2rr*staterrrtest___getstate___simple[s  z7PersistentAdapterRegistryTests.test___getstate___simplecCs.|j\}}}dd|_|jd|jkdS)NcWs dddgS)Nabcr)r rrriszXPersistentAdapterRegistryTests.test___getstate___skips_delegated_names..names)r+rDr=r<)rr2rr*rrr'test___getstate___skips_delegated_namesgs zFPersistentAdapterRegistryTests.test___getstate___skips_delegated_namescCsZ|j\}}}|j}|jd|jkd|_|jd|jk|j||jd|jkdS)NZ _v_lookup)r+r< assertTrue__dict__r1r= __setstate__)rr2rr*r>rrr$test___setstate___rebuilds__v_lookupls zCPersistentAdapterRegistryTests.test___setstate___rebuilds__v_lookupcCsfddlm}|j|jf}|j|d\}}}|j}|j||j|j||j|j |gt |dS)Nr)r5)r6) r9r5r:r;r+r<rHr.r7r8list)rr5r6r2rr*r>rrrtest___setstate___rebuilds__rous   z=PersistentAdapterRegistryTests.test___setstate___rebuilds__roN)F)rrrrr rr&r+r3r4r?rErIrKrrrrrs     rc@s$eZdZddZddZddZdS)PersistentComponentsTestscCsddlm}|S)Nr)PersistentComponents)rrM)rrMrrrrs z)PersistentComponentsTests._getTargetClasscOs|j||S)N)r)rr r rrrr sz"PersistentComponentsTests._makeOnecCsddlm}ddlm}ddlm}|j}|jt|j ||jt|j ||jt|j ||jt|j ||jt|j ||jt|j|dS)Nr)PersistentMapping)PersistentList)r)Zpersistent.mappingrNZpersistent.listrOrrr rF isinstancer:r;Z_adapter_registrationsZ_utility_registrationsZ_subscription_registrationsZ_handler_registrations)rrNrOrr2rrr2test_ctor_initializes_registries_and_registrationss          zLPersistentComponentsTests.test_ctor_initializes_registries_and_registrationsN)rrrrr rQrrrrrLsrLcCs$ddl}|jdkrt|St|dS)Nrascii)rR)sys version_infobytes)srTrrrr)s r)cCstjtjttjtfS)N)unittestZ TestSuiteZ makeSuiterrLrrrr test_suitesrY)__doc__rXZTestCaserrLr)rYrrrrs l