3 ,ςΏW/γ@spdZddlZGdd„dejƒZGdd„dejƒZGdd„dejƒZGd d „d ejƒZGd d „d eƒZd d„Z dS)zTests for z.c.registry ιNc@s,eZdZddlmZmZdd„Zdd„ZdS)Ϊ%Test_dispatchUtilityRegistrationEventr)ΪsetUpΪtearDowncOsddlm}|||ŽS)Nr)Ϊ dispatchUtilityRegistrationEvent)Ϊzope.component.registryr)ΪselfΪargsΪkwr©r ϊ#/usr/lib/python3.6/test_registry.pyΪ_callFUTs z.Test_dispatchUtilityRegistrationEvent._callFUTc spddlm}Gdd„dtƒ}tƒ}g‰‡fdd„}t||d|j|ƒ|ƒWdQRX|jˆ|j|fgƒdS)Nr)Ϊregistryc@seZdZeƒZdS)zDTest_dispatchUtilityRegistrationEvent.test_it.._RegistrationN)Ϊ__name__Ϊ __module__Ϊ __qualname__ΪobjectΪ componentr r r r Ϊ _Registrationsrcsˆj|ƒdS)N)Ϊappend)r)Ϊ_handledr r Ϊ_handle!sz>Test_dispatchUtilityRegistrationEvent.test_it.._handle)Ϊhandle)Ϊzope.componentr rΪ_Monkeyr Ϊ assertEqualr)rr rΪ_EVENTrr )rr Ϊtest_its  z-Test_dispatchUtilityRegistrationEvent.test_itN)rrrΪzope.component.testingrrr rr r r r rsrc@s,eZdZddlmZmZdd„Zdd„ZdS)Ϊ%Test_dispatchAdapterRegistrationEventr)rrcOsddlm}|||ŽS)Nr)Ϊ dispatchAdapterRegistrationEvent)rr)rrr rr r r r ,s z.Test_dispatchAdapterRegistrationEvent._callFUTc stddlm}Gdd„dtƒ}|ƒ}tƒ}g‰‡fdd„}t||d|j||ƒWdQRX|jˆ|j|fgƒdS)Nr)r c@seZdZdd„ZdS)zDTest_dispatchAdapterRegistrationEvent.test_it.._Registrationc_sdS)Nr )rrr r r r Ϊfactory3szLTest_dispatchAdapterRegistrationEvent.test_it.._Registration.factoryN)rrrr r r r r r2srcsˆj|ƒdS)N)r)r)rr r r8sz>Test_dispatchAdapterRegistrationEvent.test_it.._handle)r)rr rrr rr )rr rΪ _registrationrrr )rr r0s  z-Test_dispatchAdapterRegistrationEvent.test_itN)rrrrrrr rr r r r r(src@s,eZdZddlmZmZdd„Zdd„ZdS)Ϊ1Test_dispatchSubscriptionAdapterRegistrationEventr)rrcOsddlm}|||ŽS)Nr)Ϊ,dispatchSubscriptionAdapterRegistrationEvent)rr#)rrr r#r r r r Cs z:Test_dispatchSubscriptionAdapterRegistrationEvent._callFUTc stddlm}Gdd„dtƒ}|ƒ}tƒ}g‰‡fdd„}t||d|j||ƒWdQRX|jˆ|j|fgƒdS)Nr)r c@seZdZdd„ZdS)zPTest_dispatchSubscriptionAdapterRegistrationEvent.test_it.._Registrationc_sdS)Nr )rrr r r r r KszXTest_dispatchSubscriptionAdapterRegistrationEvent.test_it.._Registration.factoryN)rrrr r r r r rJsrcsˆj|ƒdS)N)r)r)rr r rPszJTest_dispatchSubscriptionAdapterRegistrationEvent.test_it.._handle)r)rr rrr rr )rr rr!rrr )rr rHs  z9Test_dispatchSubscriptionAdapterRegistrationEvent.test_itN)rrrrrrr rr r r r r"?sr"c@s,eZdZddlmZmZdd„Zdd„ZdS)Ϊ%Test_dispatchHandlerRegistrationEventr)rrcOsddlm}|||ŽS)Nr)Ϊ dispatchHandlerRegistrationEvent)rr%)rrr r%r r r r [s z.Test_dispatchHandlerRegistrationEvent._callFUTc stddlm}Gdd„dtƒ}|ƒ}tƒ}g‰‡fdd„}t||d|j||ƒWdQRX|jˆ|j|fgƒdS)Nr)r c@seZdZdd„ZdS)zDTest_dispatchHandlerRegistrationEvent.test_it.._Registrationc_sdS)Nr )rrr r r r ΪhandlerbszLTest_dispatchHandlerRegistrationEvent.test_it.._Registration.handlerN)rrrr&r r r r rasrcsˆj|ƒdS)N)r)r)rr r rgsz>Test_dispatchHandlerRegistrationEvent.test_it.._handle)r)rr rrr rr&)rr rr!rrr )rr r_s  z-Test_dispatchHandlerRegistrationEvent.test_itN)rrrrrrr rr r r r r$Wsr$c@s$eZdZdd„Zdd„Zdd„ZdS)rc sDˆ|_t‡fdd„|Dƒƒ|_x |jƒD]\}}tˆ||ƒq(WdS)Ncsg|]}|tˆ|ƒf‘qSr )Ϊgetattr)Ϊ.0Ϊkey)Ϊmoduler r ϊ rsz$_Monkey.__init__..)r*ΪdictΪ to_restoreΪitemsΪsetattr)rr*r r)Ϊvaluer )r*r Ϊ__init__psz_Monkey.__init__cCs|S)Nr )rr r r Ϊ __enter__vsz_Monkey.__enter__cCs*x$|jjƒD]\}}t|j||ƒq WdS)N)r-r.r/r*)rΪexc_typeZexc_valZexc_tbr)r0r r r Ϊ__exit__ysz_Monkey.__exit__N)rrrr1r2r4r r r r rnsrcCs*tjtjtƒtjtƒtjtƒtjtƒfƒS)N)ΪunittestZ TestSuiteZ makeSuiterrr"r$r r r r Ϊ test_suite}s r6) Ϊ__doc__r5ZTestCaserrr"r$rrr6r r r r Ϊs