B KMc@sddlZddlZddlZddlmZddlmZmZddlm Z ddl m Z m Z m Z mZmZmZmZmZmZmZmZdZejeZdeZdd d Ze jae jZGd d d e Z!d eZ"e!fddZ#Gddde Z$Gdddej%Z&edkre'dS)N)support) SomeClass is_instance)uncache) NonCallableMock CallableMixinsentinel MagicMockMockNonCallableMagicMockpatch_patchDEFAULTcall _get_targetbuiltinsz %s.PTModuleTcsBGfdddt}|s<fdd}fdd}||_||_|S)NcseZdZfddZdS)z_get_proxy..Proxycs t|S)N)getattr)selfname)objE/opt/alt/python37/lib64/python3.7/unittest/test/testmock/testpatch.py __getattr__sz%_get_proxy..Proxy.__getattr__N)__name__ __module__ __qualname__rr)rrrProxysrcst||dS)N)setattr)rrvalue)rrr __setattr__sz_get_proxy..__setattr__cst|dS)N)delattr)rr)rrr __delattr__!sz_get_proxy..__delattr__)objectrr!)rget_onlyrrr!r)rr _get_proxys  r$c@sPeZdZddZddZddZdZedd Ze d d Z Gd d d e Z dS)FoocCsdS)Nr)rarrr__init__.sz Foo.__init__cCsdS)Nr)rr&rrrf0szFoo.fcCsdS)Nr)rrrrg2szFoo.gbarcCsdS)Nrrrrr static_method6szFoo.static_methodcCsdS)N*r)clsrrr class_method:szFoo.class_methodc@seZdZddZdS)zFoo.BarcCsdS)Nr)rrrrr&?sz Foo.Bar.aN)rrrr&rrrrBar>sr0N) rrrr'r(r)foo staticmethodr, classmethodr/r"r0rrrrr%-s  r%z%s.FoocCsdS)Nr)r&brrrfunctionEsr5c@s4eZdZddZddZddZddZd d Zd S) ContainercCs i|_dS)N)values)rrrrr'JszContainer.__init__cCs |j|S)N)r7)rrrrr __getitem__MszContainer.__getitem__cCs||j|<dS)N)r7)rrrrrr __setitem__PszContainer.__setitem__cCs |j|=dS)N)r7)rrrrr __delitem__SszContainer.__delitem__cCs t|jS)N)iterr7)rrrr__iter__VszContainer.__iter__N)rrrr'r8r9r:r<rrrrr6Is r6c@sJeZdZdddZddZddZdd Zd d Zd d ZddZ ddZ ddZ ddZ ddZ ddZddZddZddZd d!Zd"d#Zd$d%Zd&d'Zd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Zd:d;Zdd?Z!d@dAZ"dBdCZ#dDdEZ$dFdGZ%dHdIZ&dJdKZ'dLdMZ(dNdOZ)dPdQZ*dRdSZ+dTdUZ,dVdWZ-dXdYZ.dZd[Z/d\d]Z0d^d_Z1d`daZ2dbdcZ3dddeZ4dfdgZ5dhdiZ6djdkZ7dldmZ8dndoZ9dpdqZ:drdsZ;dtduZdzd{Z?d|d}Z@d~dZAddZBddZCddZDddZEddZFddZGddZHddZIddZJddZKddZLddZMddZNddZOddZPddZQddZRddZSddZTddZUddZVeWddddZXeWddddZYddZZddZ[ddZ\ddZ]ddZ^ddZ_ddZ`ddZadd„ZbddĄZcddƄZdddȄZeddʄZfdd̄Zgdd΄ZhdS) PatchTestTcCs<t}|s t}|t||t|||t|tdS)N)r r assertRaises TypeError assertTruer assertFalser)rrmagic MockClassrrrassertNotCallable]s  zPatchTest.assertNotCallablecsJGdddttdtjfdd}|jtjddS)Nc@seZdZejZdS)z4PatchTest.test_single_patchobject..SomethingN)rrrrOriginal attributerrrr SomethinghsrGrFcsjtjddS)N unpatched) assertEqualrFrPatchedr)rGrrrtestksz/PatchTest.test_single_patchobject..testzpatch not restored)r"r rrJrIrFrE)rrKr)rGrrtest_single_patchobjectgs  z!PatchTest.test_single_patchobjectc Cs,d}|t|tddWdQRXdS)Nz>'Something' must be the actual object to be patched, not a strrGZ do_something)ZassertRaisesRegexr?r r")rmsgrrr&test_patchobject_with_string_as_targetssz0PatchTest.test_patchobject_with_string_as_targetcsHGdddttddfdd}|jtjddS)Nc@seZdZejZdS)z7PatchTest.test_patchobject_with_none..SomethingN)rrrrrErFrrrrrGysrGrFcsjddS)NrH) assertIsNonerFr)rGrrrrK|sz2PatchTest.test_patchobject_with_none..testzpatch not restored)r"r rIrFrrE)rrKr)rGrrtest_patchobject_with_nonexs  z$PatchTest.test_patchobject_with_nonecslGdddttdtjtdtjfdd}|jtjdjtj ddS)Nc@seZdZejZejZdS)z6PatchTest.test_multiple_patchobject..SomethingN)rrrrrErF Original2next_attributerrrrrGsrGrFrRcs(jtjdjtjddS)NrH)rIrFrrJrRPatched2r)rGrrrrKs  z1PatchTest.test_multiple_patchobject..testzpatch not restored) r"r rrJrSrIrFrErRrQ)rrKr)rGrrtest_multiple_patchobjects   z#PatchTest.test_multiple_patchobjectcCsFt}tdttjdd}ztja||ttjWd|aXdS)Nz %s.somethingcSsdS)NrrrrrrKsz8PatchTest.test_object_lookup_is_quite_lazy..test) somethingr rr Something2Zreplacement_valuerI)roriginalrKrrr test_object_lookup_is_quite_lazysz*PatchTest.test_object_lookup_is_quite_lazycstdttjfdd}|tjtjdtdttjtdttjfdd}tjtjdtj tjd|tjtjdtj tjdt }tj |_ tdt |fdd}||t|ddS) Nz %s.somethingcstjtjddS)NrH)rIPTModulerUrrVr)rrrrKs z"PatchTest.test_patch..testzpatch not restoredz%s.something_elsecs(tjtjdtjtjddS)NrH)rIrYrUrrVsomething_else SomethingElser)rrrrKs  z%s.opencstddtjddS)Nfilenamerzopen not patched)rIopenrHandler)rrrrKs)r rrrVrIrYrUrGr[rZr r_ return_valuebuiltin_stringassertNotEqualr^)rrKmockr)rr test_patchs*     zPatchTest.test_patchcs6tdttjfdd}|tjjddS)Nz%s.SomeClass.class_attributecstjjtjddS)NrH)rIrYrclass_attributerClassAttributer)rrrrKs z2PatchTest.test_patch_class_attribute..testzpatch not restored)r rrrfrOrYrre)rrKr)rrtest_patch_class_attributes  z$PatchTest.test_patch_class_attributecsGdddttdfdd}|tdtdfdd}d|tjtj\|tjtjdS)Nc@seZdZejZejZdS)z:PatchTest.test_patchobject_with_default_mock..TestN)rrrrrErUrQ something2rrrrTestsrirUcs"|jd|tddS)Nz"Mock not passed into test functionz.patch with two arguments did not create a mock)rIrUassertIsInstancer )rc)rirrrrKs z:PatchTest.test_patchobject_with_default_mock..testrhcs|tjd|tjd|jd|jd|td|td|d|d||fS)Nz0Patched function didn't receive initial argumentz/Patched function didn't receive second argumentz"Mock not passed into test functionz)Second Mock not passed into test functionz.patch with two arguments did not create a mockzunexpected value for mock1) rIrthis1this2rhrUrjr rb)rkrlZmock1Zmock2)ri outerMock1 outerMock2rrrrKs    )r"r rrkrl)rrKr)rirmrnrr"test_patchobject_with_default_mocks  z,PatchTest.test_patchobject_with_default_mockcs&tdttdfdd}|dS)Nz %s.SomeClass)speccs2t|ttjttdddS)NcSstjS)N)r not_wibblerrrrz>PatchTest.test_patch_with_spec..test..)rIrr@rwibbler r>AttributeError) MockSomeClass)rrrrK s z,PatchTest.test_patch_with_spec..test)r rr)rrKr)rrtest_patch_with_spec szPatchTest.test_patch_with_speccs&tjtdtdfdd}|dS)Nre)rpcs6tj|ttjjttdddS)NcSstjjS)N)rrerqrrrrrrrszDPatchTest.test_patchobject_with_spec..test..) rIrrer@rrtr r>ru) MockAttribute)rrrrKs  z2PatchTest.test_patchobject_with_spec..test)r r"r)rrKr)rrtest_patchobject_with_specsz$PatchTest.test_patchobject_with_speccs(tdtdgdfdd}|dS)Nz %s.SomeClassrt)rpcs2t|ttjttdddS)NcSstjS)N)rrqrrrrrr$rszFPatchTest.test_patch_with_spec_as_list..test..)rIrr@rrtr r>ru)rv)rrrrK s z4PatchTest.test_patch_with_spec_as_list..test)r r)rrKr)rrtest_patch_with_spec_as_listsz&PatchTest.test_patch_with_spec_as_listcs(tjtddgdfdd}|dS)Nrert)rpcs6tj|ttjjttdddS)NcSstjjS)N)rrerqrrrrrr0rszLPatchTest.test_patchobject_with_spec_as_list..test..) rIrrer@rrtr r>ru)rx)rrrrK*s  z:PatchTest.test_patchobject_with_spec_as_list..test)r r"r)rrKr)rr"test_patchobject_with_spec_as_list)sz,PatchTest.test_patchobject_with_spec_as_listcs4tdttdtdgdfdd}|dS)Nz%s.openz %s.SomeClassrt)rpcs2t|ttjttdddS)NcSstjS)N)rrqrrrrrr<rszMPatchTest.test_nested_patch_with_spec_as_list..test..)rIrr@rrtr r>ru)rvZMockOpen)rrrrK7s z;PatchTest.test_nested_patch_with_spec_as_list..test)r rar)rrKr)rr#test_nested_patch_with_spec_as_list5s  z-PatchTest.test_nested_patch_with_spec_as_listcs&tdtddfdd}|dS)Nz %s.SomeClassT)rpcs*tjtfdddS)NcsjS)N)rqr)rvrrrrGrszIPatchTest.test_patch_with_spec_as_boolean..test..)rIrrtr>ru)rv)r)rvrrKAs z7PatchTest.test_patch_with_spec_as_boolean..test)r r)rrKr)rrtest_patch_with_spec_as_boolean@sz)PatchTest.test_patch_with_spec_as_booleancs&tjtdddfdd}|dS)NrT)rpcs*tjtfdddS)NcsjS)N)rqr)rvrrrrSrszPPatchTest.test_patch_object_with_spec_as_boolean..test..)rIrrtr>ru)rv)r)rvrrKMs z>PatchTest.test_patch_object_with_spec_as_boolean..test)r r"rY)rrKr)rr&test_patch_object_with_spec_as_booleanLsz0PatchTest.test_patch_object_with_spec_as_booleancs&tdtddfdd}|dS)Nz %s.SomeClassT)rpcs>t|t|jtfdddS)NcsjS)N)rqr)instancerrrrarszVPatchTest.test_patch_class_acts_with_spec_is_inherited..test..)r@rr rDrtr>ru)rv)r)rrrKYs  zDPatchTest.test_patch_class_acts_with_spec_is_inherited..test)r r)rrKr)rr,test_patch_class_acts_with_spec_is_inheritedXs z6PatchTest.test_patch_class_acts_with_spec_is_inheritedcs:tdttjddfdd}|tdddS)Nz %s.froobleT)createcsttjdS)N)rIfrooblerFroobler)rrrrKgszLPatchTest.test_patch_with_create_mocks_non_existent_attributes..testcSstS)N)rrrrrrrlrszPPatchTest.test_patch_with_create_mocks_non_existent_attributes..)r rarrr> NameError)rrKr)rr4test_patch_with_create_mocks_non_existent_attributesfs z>PatchTest.test_patch_with_create_mocks_non_existent_attributescs:tjtdtjddfdd}|ttddS)NrT)rcstjtjdS)N)rIrrrrr)rrrrKpszRPatchTest.test_patchobject_with_create_mocks_non_existent_attributes..test)r r"rrrrAhasattr)rrKr)rr:test_patchobject_with_create_mocks_non_existent_attributesos zDPatchTest.test_patchobject_with_create_mocks_non_existent_attributescsZy&tdttjfdd}|Wntk r:Yn XdtdddS)Nz %s.frooblecsttjdS)N)rIrrrr)rrrrKzsz9PatchTest.test_patch_wont_create_by_default..testz,Patching non existent attributes should failcSstS)N)rrrrrrrrsz=PatchTest.test_patch_wont_create_by_default..)r rarrrufailr>r)rrKr)rr!test_patch_wont_create_by_defaultxs  z+PatchTest.test_patch_wont_create_by_defaultcsZy&ttdtjfdd}|Wntk r:Yn XdttddS)NordcsddS)Nz,Patching non existent attributes should fail)rr)rrrrKsz?PatchTest.test_patchobject_wont_create_by_default..testz,Patching non existent attributes should fail) r r"rrrrurrAr)rrKr)rr'test_patchobject_wont_create_by_defaults  z1PatchTest.test_patchobject_wont_create_by_defaultcCsHttddd}ttddd}||d||ddS) Nz.ordcSsd|_tdS)Nec)r`r)Zmock_ordrrrtest_ordsz>PatchTest.test_patch_builtins_without_create..test_ordz.opencSs*|j}d|j_td}|}||S)Nabcdzdoesnotexists.txt)r`readr^close)Z mock_openmZfobjdatarrr test_opens z?PatchTest.test_patch_builtins_without_create..test_openrr)r rrI)rrrrrr"test_patch_builtins_without_creates z,PatchTest.test_patch_builtins_without_createcsPGdddttdtddfdd}|tjdS)Nc@seZdZeddZdS)z5PatchTest.test_patch_with_static_methods..FoocSstjS)N)rStaticrrrrwootsz:PatchTest.test_patch_with_static_methods..Foo.wootN)rrrr2rrrrrr%sr%rcSstjS)N)rrJrrrrrrrsz:PatchTest.test_patch_with_static_methods..cstjdS)N)rIrrrJr)r%rrr anonymoussz;PatchTest.test_patch_with_static_methods..anonymous)r"r r2rIrrr)rrr)r%rrtest_patch_with_static_methodss$z(PatchTest.test_patch_with_static_methodscs8tj}ttddfdd}|tj|dS)Nr%cstjddS)Nr%)rIrr%r)rrrrsz-PatchTest.test_patch_local..anonymous)rr%r r"rI)rr1rr)rrtest_patch_localszPatchTest.test_patch_localcsTGdddt}|tj_tddfdd}|jtjdS)Nc@seZdZdZdS)z'PatchTest.test_patch_slots..Foo)r%N)rrr __slots__rrrrr%sr%csjddS)Nr%)rIr%r)r1rrrrsz-PatchTest.test_patch_slots..anonymous)r"rr%r rI)rr%rr)r1rrtest_patch_slotss zPatchTest.test_patch_slotscsfGdddtGfdddt}tdtj|}|}||jtjddS)Nc@seZdZejZdS)z=PatchTest.test_patchobject_class_decorator..SomethingN)rrrrrErFrrrrrGsrGcs(eZdZfddZfddZdS)z7PatchTest.test_patchobject_class_decorator..FoocsjtjddS)NrH)rIrFrrJ) other_self)rGrrr test_methods zCPatchTest.test_patchobject_class_decorator..Foo.test_methodcsjtjddS)Nznon-test method patched)rIrFrrE)r)rGrrrnot_test_methods zGPatchTest.test_patchobject_class_decorator..Foo.not_test_methodN)rrrrrr)rGrrrr%sr%rFzpatch not restored) r"r rrJrrrIrFrE)rr%r(r)rGrr test_patchobject_class_decorators z*PatchTest.test_patchobject_class_decoratorcsrGdddt}Gfdddt}tdt|}|}|||jtjdt j tj ddS)Nc@seZdZejZdS)z7PatchTest.test_patch_class_decorator..SomethingN)rrrrrErFrrrrrGsrGcs$eZdZfddZfddZdS)z1PatchTest.test_patch_class_decorator..Foocstj|ddS)NrH)rIrYrU)rZmock_something)rrrrs z=PatchTest.test_patch_class_decorator..Foo.test_methodcstjtjddS)Nznon-test method patched)rIrYrUrrG)r)rrrrs zAPatchTest.test_patch_class_decorator..Foo.not_test_methodN)rrrrrr)rrrr%s r%z %s.somethingzpatch not restored) r"r rrrrIrFrrErYrUrG)rrGr%r(r)rrtest_patch_class_decorators  z$PatchTest.test_patch_class_decoratorcsZGdddttdtjtdtjfdd}|jtjddS)Nc@seZdZejZejZdS)z3PatchTest.test_patchobject_twice..SomethingN)rrrrrErFrQrRrrrrrGsrGrFcsjtjddS)NrH)rIrFrrJr)rGrrrrKsz.PatchTest.test_patchobject_twice..testzpatch not restored)r"r rrJrIrFrE)rrKr)rGrrtest_patchobject_twices   z PatchTest.test_patchobject_twicecstdd}tfdd}||tddifdd}||tdgfd d}||dS) NrU)initialothercsdd<d=dd<dS)Nr&rzsomething elserrr)r1rrrKsz'PatchTest.test_patch_dict..testr&r4cs$tddddS)Nrr&r4)rIlenr)r1rrrrKs)r&r4cs$tddddS)Nrr&r4)rIrr)r1rrrrK$s)r"copyr dictrI)rrWrKr)r1rrtest_patch_dict s   zPatchTest.test_patch_dictcsttd<dd<j}tfdd}|j|tddifdd}|j|dS) NrrUrcsdd<d=dd<dS)Nrr&rzsomething elserrr)r1rrrK5sz=PatchTest.test_patch_dict_with_container_object..testr&r4cs&tjddddS)Nrr&r4)rIrr7r)r1rrrrK?s)r6r"r7rr rrI)rrWrKr)r1rr%test_patch_dict_with_container_object.s  z/PatchTest.test_patch_dict_with_container_objectcstdd}tjddfdd}||tjddiddfd d}||tjd gddfd d}||dS) NrU)rrT)clearcs idd<dd<dS)Nrr&zsomething elser)rIr)r1rrrrKMs z2PatchTest.test_patch_dict_with_clear..testr&r4csddidS)Nr&r4)rIr)r1rrrrKWs)r&r4csddidS)Nr&r4)rIr)r1rrrrK_s)r"rr rrI)rrWrKr)r1rrtest_patch_dict_with_clearIs  "  z$PatchTest.test_patch_dict_with_clearcsttd<dd<j}tjddfdd}|j|tjdd iddfd d}|j|dS) NrrUrT)rcs"jidd<dd<dS)Nrr&zsomething elser)rIr7r)r1rrrrKoszGPatchTest.test_patch_dict_with_container_object_and_clear..testr&r4csjddidS)Nr&r4)rIr7r)r1rrrrKys)r6r"r7rr rrI)rrWrKr)r1rr/test_patch_dict_with_container_object_and_clearhs  "z9PatchTest.test_patch_dict_with_container_object_and_clearcCsZi}tdtttdttddtttt|dd}||jddS)Nz %s.SomeClassT)autospeccSsdS)Nrrrrr some_namesz0PatchTest.test_name_preserved..some_namer)r rr"rrrI)rr1rrrrtest_name_preserveds  zPatchTest.test_name_preservedcCsVi}t|ddidd}y |Wntk r:Yn X|d||idS)Nr&r4cSs tddS)NZKonrad)rrrrrrKsz1PatchTest.test_patch_with_exception..testzNameError not raised by test)r rrrrI)rr1rKrrrtest_patch_with_exceptions  z#PatchTest.test_patch_with_exceptioncs&tdddifdd}|dS)Nz os.environ konrad_delongz some valuecsdtjdS)Nr)assertInosenvironr)rrrrKsz3PatchTest.test_patch_dict_with_string..test)r r)rrKr)rrtest_patch_dict_with_stringsz%PatchTest.test_patch_dict_with_stringcsZtj}tdddifdd}z&ddit_|tjddiWd|t_XdS)Nz%unittest.test.testmock.support.targetr*BARcstjddddS)NBAZr)r1r*)rIrtargetr)rrrrKsz.testr1r)rrrr rrI)rrWrKr)rr$test_patch_dict_decorator_resolutions  z.PatchTest.test_patch_dict_decorator_resolutioncsdS)Nc@seZdZdZdS)z0PatchTest.test_patch_descriptor..NothingN)rrrr1rrrrNothingsrcs|eZdZiZeddefddZeddeddZ e eefddZ e eed d Z d S) z2PatchTest.test_patch_descriptor..Somethingr1cs|dS)N)assertIs)r.)rGrrrklasssz8PatchTest.test_patch_descriptor..Something.klasscSs|S)Nr)argrrrstaticsz9PatchTest.test_patch_descriptor..Something.staticcs|dS)N)r)r.)rGrrr klass_dictsz=PatchTest.test_patch_descriptor..Something.klass_dictcSs|S)Nr)rrrr static_dictsz>PatchTest.test_patch_descriptor..Something.static_dictN) rrrr1r r"r3rr2rrrrr)rrGrrrrGs  rGZf00)r"rIrrrr)rrUr)rrGrrtest_patch_descriptorszPatchTest.test_patch_descriptorcCstdttdddd}|t|tjtdtdddd}|t|tdtddd d}|t|tjtdddd d}|t|dS) Nz %s.SomeClassT)rpspec_setcSs d|_dS)Nr1)z)rCrrrrKsz+PatchTest.test_patch_spec_set..testrcSs d|_dS)Nr1)r)rCrrrrKs)rcSs d|_dS)Nr1)r)rCrrrrKscSs d|_dS)Nr1)r)rCrrrrKs)r rrr>rur"r)rrKrrrtest_patch_spec_sets   zPatchTest.test_patch_spec_setcCs(tdtdddd}|t|dS)Nz %s.SomeClassT)rcSs|}d|_dS)Nr1)r)rCrrrrrKsz-PatchTest.test_spec_set_inherit..test)r rr>ru)rrKrrrtest_spec_set_inheritszPatchTest.test_spec_set_inheritcCs\t}tdt}|t||}z||||t|Wd|X|t|dS)Nz %s.something)rUr rrstart assertIsNotstop)rrWpatcherrcrrrtest_patch_start_stops    zPatchTest.test_patch_start_stopcCsttdd}|t|jdS)Nr*r)r foo_namer> RuntimeErrorr)rrrrrtest_stop_without_starts z!PatchTest.test_stop_without_startcCs^t}ttdd}|t||}z||d|t|Wd|X|t|dS)NrUr1)rUr r"rYrrrIr)rrWrZreplacedrrrtest_patchobject_start_stops   z%PatchTest.test_patchobject_start_stopcCsfddi}|}tj|dgdd}||||z||ddiWd|X|||dS)Nr1r*)spameggsT)rrr)rr rrIrr)rdrWrrrrtest_patch_dict_start_stop&s  z$PatchTest.test_patch_dict_start_stopcs|ddi}Gfdddt}tjddidd|}|||}|||||||}||||||dS) Nrrcs(eZdZfddZfddZdS)z7PatchTest.test_patch_dict_class_decorator..TestcsddidS)Nr1r*)rI)r)rthisrr test_first:szBPatchTest.test_patch_dict_class_decorator..Test.test_firstcsddidS)Nr1r*)rI)r)rrrr test_second<szCPatchTest.test_patch_dict_class_decorator..Test.test_secondN)rrrrrr)rrrrri9srir1r*T)r)rr"r rrIrr)rrWrirKr)rrrtest_patch_dict_class_decorator4s     z)PatchTest.test_patch_dict_class_decoratorcsGdddt}Gddd}xj||||fD]X}t|tddfdd}|jd|jddjq.WdS) Nc@seZdZdZdS)z0PatchTest.test_get_only_proxy..Somethingr1N)rrrr1rrrrrGTsrGc@seZdZdZdS)z4PatchTest.test_get_only_proxy..SomethingElser1N)rrrr1rrrrr[Vsr[r1r*csjddS)Nr*)rIr1r)proxyrrrrK\sz+PatchTest.test_get_only_proxy..test)r"r$r rIr1 assertNotIn__dict__)rrGr[thingrKr)rrrtest_get_only_proxySszPatchTest.test_get_only_proxycsGdddt}Gddd}xn||||fD]\}t|ddtddfd d }|jd|jddjq.WdS) Nc@seZdZdZdS)z6PatchTest.test_get_set_delete_proxy..Somethingr1N)rrrr1rrrrrGfsrGc@seZdZdZdS)z:PatchTest.test_get_set_delete_proxy..SomethingElser1N)rrrr1rrrrr[hsr[F)r#r1r*csjddS)Nr*)rIr1r)rrrrrKnsz1PatchTest.test_get_set_delete_proxy..test)r"r$r rIr1rr)rrGr[rrKr)rrrtest_get_set_delete_proxyes z#PatchTest.test_get_set_delete_proxycCsZtdtd}ttf|}|}||t|||j d| |jtdS)N!) side_effectzfoo.bar.return_valuer1) KeyErrorr r rrrr>rIr1r*rj)rkwargsrrcrrrtest_patch_keyword_argsws   z!PatchTest.test_patch_keyword_argscCs^tdtd}tjtdf|}|}||t|||j d| |j tdS)Nr)rzfoo.bar.return_valuer1r() rr r r"r%rrr>rIr1r*rj)rrrrcrrrtest_patch_object_keyword_argss  z(PatchTest.test_patch_object_keyword_argscCs`ddi}|}tj|dddd}|z||tddddWd|X|||dS)Nr1r*r)r1r*Zbaz)rr rrrIr)rrWrrrrrtest_patch_dict_keyword_argss z&PatchTest.test_patch_dict_keyword_argscsGdddt}fddfddfdd}ttd d |}|}t||tjt}tj|d d d |}|}t||dS) Nc@s8eZdZddZddZddZdZGdd d eZd S) z$PatchTest.test_autospec..BoocSsdS)Nr)rr&rrrr'sz-PatchTest.test_autospec..Boo.__init__cSsdS)Nr)rr&rrrr(sz&PatchTest.test_autospec..Boo.fcSsdS)Nr)rrrrr)sz&PatchTest.test_autospec..Boo.gr*c@seZdZddZdS)z(PatchTest.test_autospec..Boo.BarcSsdS)Nr)rrrrr&sz*PatchTest.test_autospec..Boo.Bar.aN)rrrr&rrrrr0sr0N) rrrr'r(r)r1r"r0rrrrBoos rcs"|d|dt|dS)N)assert_called_withr>r?)rc)rrr_tests z&PatchTest.test_autospec.._testcs|d|jdt|j||jt|jdtt|d|j|jjtt|jd| |j |j |j j t|j j d| | j t| j dtt|j dtt| ddS)Nrhr*r4) r(rr>r?r)rurr1lowerr0r&)rc)rrr_test2s(         z'PatchTest.test_autospec.._test2cs,|||d|t|S)Nr)rr%)rc)rrrrrr5s   z)PatchTest.test_autospec..functionT)rr%)r"r rrr%sysmodulesr)rrr5rKrcmoduler)rrrr test_autospecs     zPatchTest.test_autospeccs&tdtddfdd}|dS)Nz %s.functionT)rcstttjttjtdttjtdtttddtddtttt tddS)Nrrrr1) r5Zassert_not_calledr>AssertionErrorZ assert_calledZassert_called_oncerr?rur)rc)rrrrKs    z.PatchTest.test_autospec_function..test)r r)rrKr)rrtest_autospec_functionsz PatchTest.test_autospec_functioncCs0tdtddddd}|}||ddS)Nz %s.functionTr)rr`cSs tddS)Nrr)r5)Z mock_functionrrrrKsz.PatchTest.test_autospec_keywords..test)r rrI)rrKresultrrrtest_autospec_keywordss z PatchTest.test_autospec_keywordsc Cs0tdtdd}t|WdQRXdS)Nz%s.Foo.static_methodT)r)r rr%r,assert_called_once_with)rmethodrrrtest_autospec_staticmethodsz$PatchTest.test_autospec_staticmethodc Cs0tdtdd}t|WdQRXdS)Nz%s.Foo.class_methodT)r)r rr%r/r)rrrrrtest_autospec_classmethod sz#PatchTest.test_autospec_classmethodcCsNtdtddd}|t|jtjt}tj|dddd}|t|jdS)Nz %s.functionrT)newrr5)r rr>r?rrrr")rrrrrrtest_autospec_with_news  z PatchTest.test_autospec_with_newcCsRGdddt}tt|d}|}z|||||jtWd|XdS)Nc@seZdZgZdS)z0PatchTest.test_autospec_with_object..BarN)rrrextrarrrrr0sr0)r)r%r rrrjrlistr)rr0rrcrrrtest_autospec_with_objects  z#PatchTest.test_autospec_with_objectcCsHt}ttdd}|}z |||||d|Wd|XdS)NT)rr)r%r rrrjr)rZFooClassrrcrrrtest_autospec_inherits(s  z PatchTest.test_autospec_inheritscCstttdd}|}zP|dt||dt|j|dt|d|dt|djWd|XdS)NT)rz name='Foo'z name='Foo.f'z name='Foo()'z name='Foo().f')r rrrreprr(r)rrrcrrrtest_autospec_name3s zPatchTest.test_autospec_namecCsbttdtdd}y |Wnt}YnXtddd}|||}|d|dS)Nr(cSstdS)N)rrrrrrKAsz'PatchTest.test_tracebacks..testrzraise AssertionError) r r"r%rexc_infounittestZTextTestResultZ_exc_info_to_stringr)rrKerrr tracebackrrrtest_tracebacks@s  zPatchTest.test_tracebackscCsXtttd}|}||}||||x||fD]}||qBWdS)N) new_callable)r rr rrrrD)rrm1m2rcrrrtest_new_callable_patchNs  z!PatchTest.test_new_callable_patchcCs\tjtdtd}|}||}||||x||fD]}||qFWdS)Nr()r)r r"r%r rrrrD)rrr r rcrrrtest_new_callable_patch_object[s z(PatchTest.test_new_callable_patch_objectcsfGfdddtttddd}|}z*|t||jtdddWd| XdS)NcseZdZdZfddZdS)z:PatchTest.test_new_callable_keyword_arguments..BarNcs |_dS)N)r)rr)r0rrr'kszCPatchTest.test_new_callable_keyword_arguments..Bar.__init__)rrrrr'r)r0rrr0isr0rr)rarg1arg2)r r) r"r rrrtyperIrrr)rrrr)r0r#test_new_callable_keyword_argumentshsz-PatchTest.test_new_callable_keyword_argumentscsGfdddtttd}|z|jtdWd|Xttd}|z|jtdWd|XdS)NcseZdZdZfddZdS)z-PatchTest.test_new_callable_spec..BarNcs |_dS)N)r)rr)r0rrr'zsz6PatchTest.test_new_callable_spec..Bar.__init__)rrrrr'r)r0rrr0xsr0)rrp)rp)rr)r)r"r rrrIrrr)rrr)r0rtest_new_callable_specws z PatchTest.test_new_callable_speccCsZdt}t|td}|t|jt|tdd}|}z|j|ddWd|XdS)Nz %s.weeeee)rT)rrF)rB)rr rr>rurrDr)rZnon_existent_attrprrrrtest_new_callable_creates z"PatchTest.test_new_callable_createcCs4|jtttttd|jttjtdttddS)N)rrr()r> ValueErrorr rr"r r%)rrrr'test_new_callable_incompatible_with_news z1PatchTest.test_new_callable_incompatible_with_newcCs0|jttttdd|jttjtdtdddS)NT)rrr()r>rr rr r"r%)rrrr,test_new_callable_incompatible_with_autospecs  z6PatchTest.test_new_callable_incompatible_with_autospecc CsGdddt}tttt|f}xd|D]\}xVdD]N}|di}ttfd|i|}|}z|j}|t t |dWd| Xq.Wq$WdS)Nc@s eZdZdS)z>PatchTest.test_new_callable_inherit_for_mocks..MockSubN)rrrrrrrMockSubsr)rprTrx) r rr r r rrr`r>rurr) rrZ MockClassesZKlassrrrrrrrr#test_new_callable_inherit_for_mockss  z-PatchTest.test_new_callable_inherit_for_mockscCshGdddt}tt|dd}|}z$|t|||tt|dWd| X| |j t dS)Nc@seZdZddZdS)z>PatchTest.test_new_callable_inherit_non_mock..NotAMockcSs ||_dS)N)rp)rrprrrr'szGPatchTest.test_new_callable_inherit_non_mock..NotAMock.__init__N)rrrr'rrrrNotAMocksrT)rrpr`) r"r rrr@rr>rurrrIrpr%)rrrrrrr"test_new_callable_inherit_non_mocks z,PatchTest.test_new_callable_inherit_non_mockcsR|tGfdddt}tttd|}|||tdS)Ncs*eZdZfddZddZddZdS)z>PatchTest.test_new_callable_class_decorating..SomeTestcs(tt|ttdS)N)rr%rrjr)rmock_foo)rWrKrrrs  zDPatchTest.test_new_callable_class_decorating..SomeTest._testcSs||dS)N)r)rrrrrtest_twoszGPatchTest.test_new_callable_class_decorating..SomeTest.test_twocSs||dS)N)r)rrrrrtest_oneszGPatchTest.test_new_callable_class_decorating..SomeTest.test_oneN)rrrrrrr)rWrKrrSomeTestsr)r)r%r"r rrrrr)rrr)rWrKr"test_new_callable_class_decoratings   z,PatchTest.test_new_callable_class_decoratingc sttj}tj}tjtddd}tjtddd}xx||fD]l}|z,ttjdtjdWd| Xttj|tj|q:Wtjtdddfdd}|dS)Nrr)r(r)rrcs,ttjdtjddS)Nrr)rr%rIr(r)r) original_foorrrrKs z+PatchTest.test_patch_multiple..test) r%r(r)r multiplerrrrIr)r original_f original_gZpatcher1Zpatcher2rrKr)r!rrtest_patch_multiples"   zPatchTest.test_patch_multiplecCs$|ttjt|ttjtdS)N)r>rr r"rr%)rrrrtest_patch_multiple_no_kwargssz'PatchTest.test_patch_multiple_no_kwargscsVttj}tj}tjttdtdfdd}|tj|tj|dS)Nr)r(r)r1csZttj|tjdtj|t|tt|tdS)Nr) rr%r(rIr)r1r@rr )r(r1)r!rrrrKs  z8PatchTest.test_patch_multiple_create_mocks..test)r%r(r)r r"rrrI)rr#r$rKr)r!rr test_patch_multiple_create_mocks s z*PatchTest.test_patch_multiple_create_mockscsrtj}tj}ttdd}d|_ttdt}d|_|g|_|fdd}|tj|tj|dS)Nr(rr)cs tj|tjddS)Nr)rr%r)rIr()r))rrrrK*szHPatchTest.test_patch_multiple_create_mocks_different_order..test) r%r(r)r r"attribute_nameradditional_patchersrI)rr#r$rrrKr)rr0test_patch_multiple_create_mocks_different_ordersz:PatchTest.test_patch_multiple_create_mocks_different_ordercsttj}tj}tjttdtjttdttdfdd}tjttdttdtjttdfdd}ttdtjttdtjttdfdd }fd d |||tj|tj|dS) N)r()r1z.gcs|f|dS)Nr)r)r)rrrtest19sz?PatchTest.test_patch_multiple_stacked_decorators..test1cs|f|dS)Nr)r)r)rrrtest2?sz?PatchTest.test_patch_multiple_stacked_decorators..test2cs|f|dS)Nr)r)r)rrrtest3Esz?PatchTest.test_patch_multiple_stacked_decorators..test3cs|d}|d}|ttj|tj|tj|t|t t|t t|t dS)Nr(r1) poprArr%r(r)r1r@rr )r)rr(r1)r!rrrrKs    z?PatchTest.test_patch_multiple_stacked_decorators.._test)r%r(r)r r"rrrI)rr#r$r+r,r-r)rr!rr&test_patch_multiple_stacked_decorators4s$       z0PatchTest.test_patch_multiple_stacked_decoratorscCst}tj}tj}tjttdtd}|}zt|d}|d}|t |t ddg| t|| tj|| tj || t |t| t |tWd|X|tj||tj|dS)Nr)r(r)r1r(r1)r%r(r)r r"rrrrIsetrr1r@rr r)rr!r#r$rrr(r1rrr(test_patch_multiple_create_mocks_patcher_s"  z2PatchTest.test_patch_multiple_create_mocks_patchercsv|ttj}tj}Gfdddt}tjttdtd|}|}|| | tj|| tj|dS)Ncs*eZdZfddZddZddZdS)z@PatchTest.test_patch_multiple_decorating_class..SomeTestcsZttj|tjdtj|t|tt|tdS)Nr) rr%r(rIr)r1r@rr )rr(r1)r!rKrrrs  zFPatchTest.test_patch_multiple_decorating_class..SomeTest._testcSs|||dS)N)r)rr(r1rrrrszIPatchTest.test_patch_multiple_decorating_class..SomeTest.test_twocSs|||dS)N)r)rr(r1rrrrszIPatchTest.test_patch_multiple_decorating_class..SomeTest.test_oneN)rrrrrrr)r!rKrrr~srr)r(r)r1) r%r(r)r"r r"rrrrrI)rr#r$rrr)r!rKr$test_patch_multiple_decorating_classxs z.PatchTest.test_patch_multiple_decorating_classcCsftjtdd}|t|jtjtddd}|z|tjdWd|X| t tddS)Nblam)r3T)r3r) r r"r%r>rurrIr3rrAr)rrrrrtest_patch_multiple_creates z$PatchTest.test_patch_multiple_createcCstjttddgd}|}z^|tj|dtjdtjdtjj dtjj d| t t tjddWd| XdS)Nr&r4)r1rr1rrr)r r"r%rrrIr1r&r4rr>rurr)rrrrrrtest_patch_multiple_spec_sets  z&PatchTest.test_patch_multiple_spec_setcCsGdddt}tjttt|d}|}zT|tj|d|tj|d| tj|| tj|| tjtjWd| XdS)Nc@s eZdZdS)z9PatchTest.test_patch_multiple_new_callable..ThingN)rrrrrrrThingsr6)r(r)rr(r)) r"r r"r%rrrr(r)rjrr)rr6rrrrr test_patch_multiple_new_callablesz*PatchTest.test_patch_multiple_new_callablecCstj}tj}ttddttddttdddd}ttddttddttdddd}ttddttddttddd d }x:|||fD],}|t||tj||tj|qWdS) Nr)rmissingr(cSsdS)Nrrrrrthing1sz3PatchTest.test_nested_patch_failure..thing1cSsdS)Nrrrrrthing2sz3PatchTest.test_nested_patch_failure..thing2cSsdS)Nrrrrrthing3sz3PatchTest.test_nested_patch_failure..thing3)r%r(r)r r"r>rurI)rr#r$r9r:r;funcrrrtest_nested_patch_failures       z#PatchTest.test_nested_patch_failurec Cstj}tj}tj}dd}ttddtjtd|dttdddd }tjtd|dttddttddd d }ttddttddtjtd|dd d }xH|||fD]:}|t||tj||tj||tj|qWdS)NcSs tddS)Ncrasher)rrrrrr>sz4PatchTest.test_new_callable_failure..crasherr)rr1)rr(cSsdS)Nrrrrrr9sz3PatchTest.test_new_callable_failure..thing1cSsdS)Nrrrrrr:sz3PatchTest.test_new_callable_failure..thing2cSsdS)Nrrrrrr;sz3PatchTest.test_new_callable_failure..thing3) r%r(r)r1r r"r>rrI) rr#r$r!r>r9r:r;r<rrrtest_new_callable_failures$     z#PatchTest.test_new_callable_failurecCstj}tj}ttdd}d|_ttdd}d|_ttdd}d|_xR||g||gfD]>}||_|dd}|t|| tj|| tj|qZWdS)Nr(rr)r8cSsdS)Nrrrrrr<sz3PatchTest.test_patch_multiple_failure..func) r%r(r)r r"r(r)r>rurI)rr#r$rgoodbad additionalsr<rrrtest_patch_multiple_failures  z%PatchTest.test_patch_multiple_failurec Cstj}tj}tj}dd}ttdd}d|_ttdd}d|_tjtd|d}d|_x`||g||gfD]L}||_|dd } |t | | tj|| tj|| tj|qjWdS) NcSs tddS)Nr>)rrrrrr>$szCPatchTest.test_patch_multiple_new_callable_failure..crasherr(rr)r1)rcSsdS)Nrrrrrr<3sz@PatchTest.test_patch_multiple_new_callable_failure..func) r%r(r)r1r r"r(r)r>rrI) rr#r$r!r>rr@rArBr<rrr(test_patch_multiple_new_callable_failures"  z2PatchTest.test_patch_multiple_new_callable_failurecsLtdtfddi}|tjddfdd}|jddS)Nr%fishZtastyz nearly gone)rEcsjddS)Nz nearly gone)rIrEr)r1rrrrK@sz=PatchTest.test_patch_multiple_string_subclasses..test)rstrr r"rIrE)rr%rKr)r1rr%test_patch_multiple_string_subclasses=s z/PatchTest.test_patch_multiple_string_subclasseszunittest.mock.patch.TEST_PREFIXr1cCslGdddt}t|dd|}|}||d||d||d||ddS)Nc@s0eZdZdZddZddZddZdd Zd S) z-PatchTest.test_patch_test_prefix..FoorWcSs|jS)N)r)rrrrfoo_oneMsz5PatchTest.test_patch_test_prefix..Foo.foo_onecSs|jS)N)r)rrrrfoo_twoOsz5PatchTest.test_patch_test_prefix..Foo.foo_twocSs|jS)N)r)rrrrrQsz6PatchTest.test_patch_test_prefix..Foo.test_onecSs|jS)N)r)rrrrrSsz6PatchTest.test_patch_test_prefix..Foo.test_twoN)rrrrrHrIrrrrrrr%Js r%rchangedrW)r"r rIrHrIrr)rr%r1rrrtest_patch_test_prefixHs z PatchTest.test_patch_test_prefixr*csGfdddt}dditjdd|}|}||ddi||ddi||ddi||ddidS)Ncs<eZdZfddZfddZfddZfddZd S) z2PatchTest.test_patch_dict_test_prefix..FoocstS)N)r)r)the_dictrrbar_onebsz:PatchTest.test_patch_dict_test_prefix..Foo.bar_onecstS)N)r)r)rLrrbar_twodsz:PatchTest.test_patch_dict_test_prefix..Foo.bar_twocstS)N)r)r)rLrrrfsz;PatchTest.test_patch_dict_test_prefix..Foo.test_onecstS)N)r)r)rLrrrhsz;PatchTest.test_patch_dict_test_prefix..Foo.test_twoN)rrrrMrNrrr)rLrrr%as   r%keyrWrJ)rO)r"r rrIrMrNrr)rr%r1r)rLrtest_patch_dict_test_prefix_s z%PatchTest.test_patch_dict_test_prefixc CsxdD]x}tdtf|di}|}zL|dt||dt|j|dt||dt|jWd|XqWdS)N)rprrz %s.SomeClassTz name='SomeClass'z! name='SomeClass.class_attribute'z name='SomeClass()'z# name='SomeClass().class_attribute')r rrrrrer)rrrrrrrtest_patch_with_spec_mock_reprus  z(PatchTest.test_patch_with_spec_mock_reprc CsJtddd4}|dt|j|dt|WdQRXdS)Nzunittest.test.testmock.supportT)rz" name='support.SomeClass.wibble()'z$ name='support.SomeClass().wibble()')r rrrrt)rrrrrtest_patch_nested_autospec_reprs z)PatchTest.test_patch_nested_autospec_reprc CsxdD]}tdtf|di}|}z|tg}||j|||j|||jjtg|}|t||j|||t||j|||jtg||jjtg||jtgWd| XqWdS)N)rprrz %s.SomeClassT) r rrrtrrIZ mock_callsZ method_callsappendr)rrrrZkallsrrrrtest_mock_calls_with_patchs&   z$PatchTest.test_mock_calls_with_patchc Csptd}|t|jtd:t}|tjd<d|_td}d|_|| WdQRX| |jddS)Nz squizz.squozzsquizzr) r r> ImportErrorrrr rrZsquozzrrI)rZp1rUrrrtest_patch_imports_lazilys  z#PatchTest.test_patch_imports_lazilyc sGdddGfdddtfdd}|ddd }td "t}|tjd <|t|WdQRX|jd t| jd d | jdddS)Nc@seZdZdZdS)z.holder)NNNN)rrrrrrrrholdersrYcseZdZdfdd ZeZdS)zBPatchTest.test_patch_propogrates_exc_on_exit..custom_patchNcs t|||||||f_dS)N)r __exit__r)retypevaltb)rYrrrZszKPatchTest.test_patch_propogrates_exc_on_exit..custom_patch.__exit__)NNN)rrrrZrr)rYrr custom_patchsr^c s$t|\}}||tdddddi S)NF)rr)rgetterrF)r^rrwith_custom_patchs  zGPatchTest.test_patch_propogrates_exc_on_exit..with_custom_patchz squizz.squozzcSstdS)N)r)rcrrrrKsz:PatchTest.test_patch_propogrates_exc_on_exit..testrUrrzexception value not propgatedrz!exception traceback not propgated) r rr rrr>rrrZassertIsNotNone)rr`rKrUr)r^rYr"test_patch_propogrates_exc_on_exits     z,PatchTest.test_patch_propogrates_exc_on_exitcCstxndD]f}tdtfddi|di}|t|j|tddttfddi|di}||qWdS)N)rprrz%s.doesnotexistrTcSstS)N) doesnotexistrrrrrrrsz1PatchTest.test_create_and_specs..)r rr>r?rrMODNAMEr)rkwargrrrrtest_create_and_specss  zPatchTest.test_create_and_specscCst}x>dD]6}ttfddi|di}|t|j|t|q Wx>dD]6}ttfddi|di}|t|j|t|qJWx>dD]6}ttfddi|di}|t|j|t|qWdS)N)rprrr)rprr)rrrp)rYr rcr>r?rr)rrWrdrrrrtest_multiple_specss   zPatchTest.test_multiple_specscCs8ttdddd}|}z|jd|_Wd|XdS)NF)rprrr)r rcrZdoes_not_existr)rrrcrrr test_specs_false_instead_of_nones  z*PatchTest.test_specs_false_instead_of_nonec CsJxDdD]<}ttf|di}|}z|tt|dWd|XqWdS)N)rprrrZ doesnotexit)r rcrr>rurr)rrdrrrrrtest_falsey_specs  zPatchTest.test_falsey_specc Csdx^dD]V}ttfddi|di}|}z&|tt|dd|tt|dWd|XqWdS)N)rprrTrbrU)r rcrr>rurrr)rrdrrrrrtest_spec_set_true s  zPatchTest.test_spec_set_truecCs:d}tt|d}|}z|t|Wd|XdS)N)__call__)rp)r rcrr@callabler)rrprrrrrtest_callable_spec_as_lists  z$PatchTest.test_callable_spec_as_listcCs:d}tt|d}|}z|t|Wd|XdS)N)r1r*)rp)r rcrrArkr)rrprrrrrtest_not_callable_spec_as_list#s  z(PatchTest.test_not_callable_spec_as_listcs^tjtjtj}tdttdttdfdd}|tj|dS)Nz os.unlinkzos.chdirzos.pathcs6ttj|tjtjdS)N)r stopallrrpathunlinkchdir)Z mock_path)rqrrprrpatched4sz-PatchTest.test_patch_stopall..patched) rrprqror rUrrZr)rrorrr)rqrrprtest_patch_stopall-szPatchTest.test_patch_stopallcsRgGdddtfddfdddDt|dd d gdS) Nc@seZdZdZZZdS)z*PatchTest.test_stopall_lifo..thingN)rrronetwothreerrrrr@src s8Gfdddtfddddddddi S)Ncs"eZdZfddZZS)z?PatchTest.test_stopall_lifo..get_patch..mypatchcst|S)N)rSsuperr)r) __class__rFmypatchstoppedrrrEs zDPatchTest.test_stopall_lifo..get_patch..mypatch.stop)rrrr __classcell__r)rFryrz)rxrryDsrycsS)Nrr)rrrrrHrsz@PatchTest.test_stopall_lifo..get_patch..F)r )rF)rzr)rFryr get_patchCsz.PatchTest.test_stopall_lifo..get_patchcsg|]}|qSr)r).0r\)r|rr Jsz/PatchTest.test_stopall_lifo..)rtrurvrvrurt)r"r rnrI)rr)r|rzrrtest_stopall_lifo>s zPatchTest.test_stopall_lifoc Cs>ddd}t|dd||dWdQRX||dt|dd||jdWdQRX||jd t|d d ||jd WdQRX||jd t|d tdg||jtdgWdQRX||jtdddd}t|dtdg||dWdQRX||ddS)NrcSs|S)TESTr)rrrrr1Qsz)PatchTest.test_special_attrs..foo __defaults__)rr__doc__ZFUNrrZ testpatch2z unittest.test.testmock.testpatch__annotations__)sr)rcWs|S)Nr)rr&rrrr1ds__kwdefaults__)rr)r)r r"rIrrrr)rr1rrrtest_special_attrsPs" zPatchTest.test_special_attrsN)T)irrrrDrLrNrPrTrXrdrgrorwryrzr{r|r}r~rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r rrrrrrrr r%r&r'r*r/r1r2r4r5r7r=r?rCrDrGr rKrPrQrRrTrXrarerfrgrhrirlrmrsrrrrrrr=[s   + *          ! +     G         +!!  "      r=__main__)T)(rrrZunittest.test.testmockrZunittest.test.testmock.supportrrZtest.test_importlib.utilrZ unittest.mockrrrr r r r r rrrrarrrYrcr$rGrUr[rZr"r%rr5r6ZTestCaser=mainrrrrsB  4