3 ,W@s*dZddlZGdddejZddZdS)zPure-Python hookable tests Nc@sdeZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ dS) HookableTestscCsddlm}|jt|dS)Nr)hookable)zope.component.hookabler assertRaises TypeError)selfrr#/usr/lib/python3.6/test_hookable.pytest_ctor_no_funcs zHookableTests.test_ctor_no_funccCs@ddlm}dd}||}|j|j|k|j|j|kdS)Nr)rcSsdS)Nrrrrr foosz+HookableTests.test_ctor_simple..foo)rr assertTrueoriginalimplementation)rrr hookedrrr test_ctor_simples  zHookableTests.test_ctor_simplecCs(ddlm}dd}|jt|||dS)Nr)rcSsdS)Nrrrrr r #sz.HookableTests.test_ctor_extra_arg..foo)rrrr)rrr rrr test_ctor_extra_arg!s z!HookableTests.test_ctor_extra_argcCs*ddlm}dd}|jt|||ddS)Nr)rcSsdS)Nrrrrr r )sz3HookableTests.test_ctor_extra_arg_miss..foo)Znonesuch)rrrr)rrr rrr test_ctor_extra_arg_miss's z&HookableTests.test_ctor_extra_arg_misscCsRddlm}dd}dd}||}|j||j|j|k|j|j|kdS)Nr)rcSsdS)Nrrrrr r /sz'HookableTests.test_sethook..foocSsdS)Nrrrrr bar1sz'HookableTests.test_sethook..bar)rrsethookr r r)rrr rrrrr test_sethook-s  zHookableTests.test_sethookcCsZddlm}dd}dd}||}|j||j|j|j|k|j|j|kdS)Nr)rcSsdS)Nrrrrr r :sz%HookableTests.test_reset..foocSsdS)Nrrrrr r<sz%HookableTests.test_reset..bar)rrrresetr r r)rrr rrrrr test_reset8s  zHookableTests.test_resetc Csdddlm}dd}dd}||}y ||_Wn&tk rBYntk rTYn X|jddS)Nr)rcSsdS)Nrrrrr r Fsz4HookableTests.test_cant_assign_original..foocSsdS)Nrrrrr rHsz4HookableTests.test_cant_assign_original..barzAssigned original)rrr rAttributeErrorfail)rrr rrrrr test_cant_assign_originalDs  z'HookableTests.test_cant_assign_originalc CsZddlm}dd}||}y|`Wn&tk r8Yntk rJYn X|jddS)Nr)rcSsdS)Nrrrrr r Vsz4HookableTests.test_cant_delete_original..foozDeleted original)rrr rrr)rrr rrrr test_cant_delete_originalTs z'HookableTests.test_cant_delete_originalc Csdddlm}dd}dd}||}y ||_Wn&tk rBYntk rTYn X|jddS)Nr)rcSsdS)Nrrrrr r dsz:HookableTests.test_cant_assign_implementation..foocSsdS)Nrrrrr rfsz:HookableTests.test_cant_assign_implementation..barzAssigned implementation)rrrrrr)rrr rrrrr test_cant_assign_implementationbs  z-HookableTests.test_cant_assign_implementationc CsZddlm}dd}||}y|`Wn&tk r8Yntk rJYn X|jddS)Nr)rcSsdS)Nrrrrr r tsz:HookableTests.test_cant_delete_implementation..foozDeleted implementation)rrrrrr)rrr rrrr test_cant_delete_implementationrs z-HookableTests.test_cant_delete_implementationcsLddlm}gfdd}||}|dddd|jd d difgdS) Nr)rcsj||fdS)N)append)argskw)_calledrr r sz-HookableTests.test_ctor___call__..fooonetwoZbaz)rr)r"r#)rrZ assertEqual)rrr rr)r!r test_ctor___call__s   z HookableTests.test_ctor___call__N)__name__ __module__ __qualname__r rrrrrrrrrr$rrrr rs  rcCstjtjtfS)N)unittestZ TestSuiteZ makeSuiterrrrr test_suitesr))__doc__r(ZTestCaserr)rrrr sw