f _pc@sddlZddlZddlZddlZddlmZmZmZmZm Z m Z m Z m Z m Z mZddlmZddlmZGdddeZGdddejZGd d d ejZGd d d ejZGd ddejZGdddejZedkredS)N) call_Callcreate_autospec MagicMockMockANY _CallListpatch PropertyMock _callable)datetimepartialc@s&eZdZddZddZdddZdS) SomeClasscCdSNselfabrr;/usr/lib64/python3.10/unittest/test/testmock/testhelpers.pyonez SomeClass.onecCrrrrrrrtworz SomeClass.twoNcCrrrrrrrrthreerzSomeClass.threer)__name__ __module__ __qualname__rrrrrrrrsrc@<eZdZddZddZddZddZd d Zd d Zd S)AnyTestcCsF|ttt}|t|tt}|td|jtddSNfoo) assertEqualrobjectrassert_called_withrmockrrrtest_anys  zAnyTest.test_anycCs$|ttd|ttddS)Nz)r%reprrstrrrrr test_repr"szAnyTest.test_reprcCs,t}|ttd|jttddSr")rr nowr'rr(rrrtest_any_and_datetime'szAnyTest.test_any_and_datetimecCst}Gdddt}t|fD]}|||||d|j|||d|j||dttttdtjtttdttjttdg}|||j ||j |q$dS)Nc@eZdZddZddZdS)z9AnyTest.test_any_mock_calls_comparison_order..FoocSrrrrotherrrr__eq__1rz@AnyTest.test_any_mock_calls_comparison_order..Foo.__eq__cSrrrr1rrr__ne__2rz@AnyTest.test_any_mock_calls_comparison_order..Foo.__ne__N)rrrr3r4rrrrFoo0r5r$bar)ZzingaZalpha)Za1Zz99) rr&r r. reset_mockmethodrrr% mock_calls)rr)r5Zdexpectedrrr$test_any_mock_calls_comparison_order.s z,AnyTest.test_any_mock_calls_comparison_ordercCsNGddd}t}||d|ttdg|td|tddS)Nc@eZdZddZdS)z%AnyTest.test_any_no_spec..FoocSrrrr1rrrr3Frz,AnyTest.test_any_no_spec..Foo.__eq__Nrrrr3rrrrr5Er5rassert_has_callsrrr'assert_any_callrr5r)rrrtest_any_no_specCs   zAnyTest.test_any_no_speccCsRGddd}t|d}||d|ttdg|td|tddS)Nc@r>)z*AnyTest.test_any_and_spec_set..FoocSrrrr1rrrr3Qrz1AnyTest.test_any_and_spec_set..Foo.__eq__Nr?rrrrr5Pr@r5)specrArBrErrrtest_any_and_spec_setNs    zAnyTest.test_any_and_spec_setN) rrrr*r-r/r=rFrHrrrrr!s   r!c@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+S),CallTestcCst}||t||td||td||tif||td||tdif||tddif||td||td||tdif||td diftd }||td ||td ||td if||tdd iftd }||td ||tdd iftd}||td||tddif||td||tddiftddif}||tddddif||tdddif||tdddif||tddifdS)N)r)rJrrJrr#r8rbazZspamrA)rJrOrO)rArP)r$rR)rJrRrR)r8rRr8rrQrr%assertNotEqual)rkallrrrtest_call_with_call\s<zCallTest.test_call_with_callcCsjt}||d||d||d||d||ddif||dif||ifdS)Nrr#rKr$rr$)rr%rargsrrrtest_empty__Calls    zCallTest.test_empty__CallcCstddif}||d||d||ddif||dif||d||d||if||d||d||difdS) Nr$rr#rXrK)r8rLr8rTrYrrrtest_named_empty_calls      zCallTest.test_named_empty_callcCsftdif}||d||d||ddif||dif||jd||jidS)NrOrNr$rOr$)rr%rZkwargsrYrrrtest_call_with_argss   zCallTest.test_call_with_argscCshtddif}||d||ddif||jd||ji||d||difdS)Nr$rOr]rN)rr%rZr^rUrYrrrtest_named_call_with_argss  z"CallTest.test_named_call_with_argsc Cstdtdddf}||tdddf||dtdddf||ddtdddf||dtdddf||jd||jtddddS)NrrQrSrrr$)rdictr%rZr^rYrrrtest_call_with_kwargsszCallTest.test_call_with_kwargsc Cstddtdddf}||dtdddf||ddtdddf||jd||jtddd||tdddf||dtdddfdS)Nr$rrQrSra)rrbr%rZr^rUrYrrrtest_named_call_with_kwargssz$CallTest.test_named_call_with_kwargscCsNtdif}||tddd|tddd||tddd|gdS)NrOrArPrQ)rr%rassertInrYrrr#test_call_with_args_call_empty_names z,CallTest.test_call_with_args_call_empty_namecCsR|tdtdd|tdtdddk|tdiftdddkdS)NrNrArPrQrArP)rUrr assertFalse assertTruerrrr test_call_neszCallTest.test_call_necCs8td}dd|tfD]}||||||kqdS)NrNrA)rintrUrh)rrVvaluerrrtest_call_non_tupless zCallTest.test_call_non_tuplescCs^|ttd|ttdd|ttdddifd|ttddddifd |ttd |ttd |ttd|ttd d |ttd dd|ttjd|ttd jjddjd|ttjd dddd|ttd|ttd dd|ttj d ddS)Nzcall()r#z call.foo()rOrrzcall(1, 2, 3, a='b')r8zcall.bar(1, 2, 3, a='b')rrAzcall(1)Zthing)Zzzzcall(zz='thing')z call().foorQrzcall().foo.bar().bingrPzcall().foo(1, 2, a=3)zcall()()z call()(2)zcall()().bar().baz.beep(1)) r%r+rrr,r$r8bingrMbeeprrrrr-s6zCallTest.test_reprcCs||tddif|tddddddddddft}|d d d|dd d ||jtd d dtdd d gdS) NrJrr$r8rQrS)rrr7rArPra)r%rrcall_args_listr(rrr test_calls  zCallTest.test_callcCs|tdddif|tjjddddddift}|dd d |jjd d d ||jtdd d tjjd d d gdS) NrAr$)rAZeggs)fishzbar.bazrrtrPrQrqra)r%rr$r8rMr method_callsr(rrrtest_attribute_call s zCallTest.test_attribute_callc Cstddjddd}||ddtddft}|ddddd||jtddddd||jtddd||jtdddddg||j tdddddgt}|dj j d dtdj j d d}||j d |||j | dS) NrArPrQrSrnz ().foo().barrQrarqi) rr$r8r%rbrZ call_argsrUrrr;rMrp call_list)rZresultr)Z last_callrrrtest_extended_callszCallTest.test_extended_callcCs@tddj}tddj}|||||||||dSNrAxrP)rr$r%rUrrrrtest_extended_not_equal*s     z CallTest.test_extended_not_equalcCsHtddj}tddj}|||||||||dSrz)rr$r8r%rUrrrrtest_nested_calls_not_equal2s   z$CallTest.test_nested_calls_not_equalcCst}|d|td|jt}|dd|tdd|jt}|ddd|tddd|jt}t|dddjj ddtdddjj dd }|||jdS)NrArPrQrS) rr%rrxr;r:rkr$r8rM__int__)rr)rVrrrtest_call_list:s"$$zCallTest.test_call_listcCs>|ttt}t|||jtg|tg|jdSr)r%rrrrkr;rmrrr test_call_anyOs  zCallTest.test_call_anycCshtdddifdd}|t|d||dd||ddditdddif}|||dS) NrgrrQT)rrPrrA)rr%Zlen)rrZZ other_argsrrrtest_two_args_callXs zCallTest.test_two_args_callcCsJ|tdddd|tddd|tdddifdddS) Nrr$r)r8ZbarzrJrZhelloZworld)r%rrrrrtest_call_with_nameaszCallTest.test_call_with_namec Cst}|d||jtttdtgt}d|d<||jtttddgt}t|||jtttgdS)Nr8rA) rr$r%r;rZ __getitem__Z __setitem__ZiterZ__iter__rrrrtest_dunder_callfs$*zCallTest.test_dunder_callN)rrrrWr[r\r_r`rcrdrfrjrmr-rsrvryr}r~rrrrrrrrrrIZs*%         rIc@s<eZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9d:Zd;d<Z d=d>Z!d?d@Z"dAdBZ#dCdDZ$dEdFZ%dGdHZ&dIdJZ'dKdLZ(dMS)NSpecSignatureTestcCs|tt|d|dd|jdd|t|jjdd|t|jd||j|t|jjd|t|jd||j|t|jjd|t|jdd|d|jd|jdd|jjdddS)Nr$rArPrQrSrn) assertRaisesAttributeErrorgetattrrr'AssertionError TypeErrorrrr(rrr_check_someclass_mock}s.       z'SpecSignatureTest._check_someclass_mockcCs*tt}||tt}||dSr)rrrr(rrr test_basics  zSpecSignatureTest.test_basiccCsPdd}t|dd}||dGdddt}t|dd}||ddS)NcSrrrrrrrfrz>SpecSignatureTest.test_create_autospec_return_value..fr$ return_valuec@ eZdZdS)z@SpecSignatureTest.test_create_autospec_return_value..FooNrrrrrrrr5r@r5)rr%r&)rrr)r5rrr!test_create_autospec_return_values   z3SpecSignatureTest.test_create_autospec_return_valuecCs,tt}t||||jjddS)Nr)rrkr9r%rZ call_countrrrrtest_autospec_reset_mocksz*SpecSignatureTest.test_autospec_reset_mockcCs>Gdddt}t|d}|}|d|ddS)Nc@r>)z;SpecSignatureTest.test_mocking_unbound_methods..FoocSrrr)rr$rrrr$rz?SpecSignatureTest.test_mocking_unbound_methods..Foo.fooNrrrr$rrrrr5r@r5r$rA)r&rstartr$r')rr5pZmock_foorrrtest_mocking_unbound_methodss   z.SpecSignatureTest.test_mocking_unbound_methodscCs.Gdddt}t|dd}||jddS)Nc@eZdZdZdS)zESpecSignatureTest.test_create_autospec_keyword_arguments..FoorQNrrrrrrrrr5r@r5Z3rn)r&rr%r)rr5rrrr&test_create_autospec_keyword_argumentss z8SpecSignatureTest.test_create_autospec_keyword_argumentscCsVdddd}t|}|d|d|t|dd|ddd|jddddS)NrcSrrrrarrrr$rzJSpecSignatureTest.test_create_autospec_keyword_only_arguments..foorArPrQ)rr'rr)rr$rrrr+test_create_autospec_keyword_only_argumentss  z=SpecSignatureTest.test_create_autospec_keyword_only_argumentscCs6t}dd}||_t|}|d|jddS)NcSrrrrnrrrrrz@SpecSignatureTest.test_function_as_instance_attribute..fro)rrrr')robjrr)rrr#test_function_as_instance_attributes  z5SpecSignatureTest.test_function_as_instance_attributecCsvtg}|d|jd|tt|dGdddt}t|}|jd|jjd|tt|jddS)Nr$c@seZdZgZdS)z0SpecSignatureTest.test_spec_as_list..FooNrrrrrr5r@r5rQ)rappendr'rrrr&r$)rr)r5rrrtest_spec_as_lists   z#SpecSignatureTest.test_spec_as_listcCs6Gdddt}t|}||jfD]}||q"dS)Nc@eZdZeZdS)z.SpecSignatureTest.test_attributes..SubNrrrrattrrrrrSubr@r)rrrr)rrZsub_mockr)rrrtest_attributessz!SpecSignatureTest.test_attributescsGdddtGfdddt}t|}|d|t|Wdn1s^0Y|t|ddWdn1s0YdS)Nc@r>)zVSpecSignatureTest.test_spec_has_descriptor_returning_function..CrazyDescriptorcSs|durddSdS)NcSrrrr{rrrrzpSpecSignatureTest.test_spec_has_descriptor_returning_function..CrazyDescriptor.__get__..r)rrZtype_rrr__get__z^SpecSignatureTest.test_spec_has_descriptor_returning_function..CrazyDescriptor.__get__NrrrrrrrrCrazyDescriptorrcseZdZZdS)zNSpecSignatureTest.test_spec_has_descriptor_returning_function..MyClassN)rrr some_attrrrrrMyClassrrrArP)r&rrrr)rrr)rrr+test_spec_has_descriptor_returning_functions  & z=SpecSignatureTest.test_spec_has_descriptor_returning_functioncsGfdddt}|t|jWdn1s@0Y||ddt|}|d|t|Wdn1s0Y|t|ddWdn1s0YdS)Ncs&eZdZfddZddZZS)zISpecSignatureTest.test_spec_has_function_not_in_bases..CrazyClasscst|dgS)Ncrazy)Zsuper__dir__r) CrazyClass __class__rrr zQSpecSignatureTest.test_spec_has_function_not_in_bases..CrazyClass.__dir__cSs|dkrddSt|dS)NrcS|Srrr{rrrrrzgSpecSignatureTest.test_spec_has_function_not_in_bases..CrazyClass.__getattr__..r)rZitemrrr __getattr__zUSpecSignatureTest.test_spec_has_function_not_in_bases..CrazyClass.__getattr__)rrrrrZ __classcell__rr)rrr sr*rArP)r&rrr2r%rrr)rZinstr)rrr#test_spec_has_function_not_in_bases s  $  & z5SpecSignatureTest.test_spec_has_function_not_in_basescCsGdddt}t|}|d|jd|tt|jd|d|jd|t|jdd|tt|jd| ddg|j ddg|tt|j d|j d|j j d|tt|j ddS)Nc@seZdZddZeZiZdS)zGSpecSignatureTest.test_builtin_functions_types..BuiltinSubclasscSrrr)rZargrrrr8'rzKSpecSignatureTest.test_builtin_functions_types..BuiltinSubclass.barN)rrrr8sortedrrrrrBuiltinSubclass&rrQr$r8rArP) listrrr'rrrr8rrrZpoprrr)rrrtest_builtin_functions_types"s     z.SpecSignatureTest.test_builtin_functions_typescCsGdddt}t|}|dd||dtddttdg}||j||jdd|j|jd| tjddtjtjdg||j|dS)Nc@r)z0SpecSignatureTest.test_method_calls..SubNrrrrrr?r@rrArPrQ) rrrrrrr%rurZextend)rrr)r<rrrtest_method_calls>s     z#SpecSignatureTest.test_method_callscCs|Gdddt}t|}|t|g|tt||tt|j|t|g||dt||jdtdS)Nc@seZdZiZdS)z=SpecSignatureTest.test_magic_methods..BuiltinSubclassN)rrrrrrrrrUr@rr$) rrr%rrrkrassertIsInstancerrrrrtest_magic_methodsTsz$SpecSignatureTest.test_magic_methodscCs`Gdddt}||fD]@}t|dd}|||tt|dd|tt|jddqdS)Nc@r)z,SpecSignatureTest.test_spec_set..SubNrrrrrrcr@rT)Zspec_setr$r8)rrrrrZsetattrr)rrrGr)rrr test_spec_setbs   zSpecSignatureTest.test_spec_setcCsGdddt}Gddd|}Gdddt|}||||||fD]@}t|}|dd|jdd|d d |jd d qHdS) Nc@s$eZdZeddZeddZdS)z/SpecSignatureTest.test_descriptors..FoocSrrr)clsrrrrrrprz1SpecSignatureTest.test_descriptors..Foo.fcSrrrrarrrgrrz1SpecSignatureTest.test_descriptors..Foo.gN)rrr classmethodr staticmethodrrrrrr5os r5c@r)z/SpecSignatureTest.test_descriptors..BarNrrrrrBarurrc@r)z/SpecSignatureTest.test_descriptors..BazNrrrrrBazwrrrArPrQrS)r&rrrassert_called_once_withr)rr5rrrGr)rrrtest_descriptorsns  z"SpecSignatureTest.test_descriptorscCsGdddt}||_t|}|||jj||j||jttjg| |j |j | |j |j |j |t|j j jdS)Nc@seZdZddZdZeZdS)z+SpecSignatureTest.test_recursive..AcSrrrrrrrrrz-SpecSignatureTest.test_recursive..A.az foo bar bazN)rrrrr$r8rrrrArr)r&ZBrrhZcalledrr%rurZassertIsr$r8 assertIsNotZlowerrrr')rrr)rrrtest_recursives  z SpecSignatureTest.test_recursivecCs^Gdddt}t|}|||||fD]L}|jdd|jjdd|jd|t|jdd|tt|dq0t|}|d|jd|jjdd|t|jdd|tt|d|t||j d|j j d|j j jdd |tt|j d | d| j d| j jdd |tt| d dS) Nc@s$eZdZddZGdddeZdS)z@SpecSignatureTest.test_spec_inheritance_for_classes..FoocSrrr)rr|rrrrrzBSpecSignatureTest.test_spec_inheritance_for_classes..Foo.ac@r>)zDSpecSignatureTest.test_spec_inheritance_for_classes..Foo.BarcSrrr)ryrrrrrzFSpecSignatureTest.test_spec_inheritance_for_classes..Foo.Bar.fNrrrrrrrrrr@rN)rrrrr&rrrrrr5r6r5rr{r$r8rrq)rr) r&rrrr'rrrrrr)rr5Z class_mockZ this_mockZ instance_mockrrr!test_spec_inheritance_for_classess0       z3SpecSignatureTest.test_spec_inheritance_for_classescCsGdddt}||_t|}|}|tt|d|}|tt|dt|}|tt|d|t||}|tt|ddS)Nc@r)z+SpecSignatureTest.test_inherit..FoorQNrrrrrr5r@r5r)r&r5rrrrr)rr5r)instanceZ attr_instanceZ call_resultrrr test_inherits  zSpecSignatureTest.test_inheritcCstdtttdtttitttgtttttttdtttdtttdtddS)NrAr$g?y?FT)rrkr,rbrZsetZfloatZcomplexrrrr test_builtinss  zSpecSignatureTest.test_builtinscCsdd}t|}|t||dd|dd|jddd|jddd||_t|}|t|j|dd|jdd|jjddddS) NcSrrrrarrrrrz*SpecSignatureTest.test_function..frArPrrarQrS)rrrr'rrrr)rrr test_functions    zSpecSignatureTest.test_functioncsGdddtGfdddt}||dddt||tfdd |ddjj|tfd d j}|j |j fdS) Nc@seZdZdddZdS)z;SpecSignatureTest.test_skip_attributeerrors..RaiserNcSs|durtddS)Nz$Can only be accessed via an instancer)rrtyperrrrrzCSpecSignatureTest.test_skip_attributeerrors..Raiser.__get__rrrrrrRaiserr@rcseZdZZeddZdS)z@SpecSignatureTest.test_skip_attributeerrors..RaiserClasscSs||SrrrarrrexistingszISpecSignatureTest.test_skip_attributeerrors..RaiserClass.existingN)rrrraiserrrr)rrr RaiserClasssrrArPrQcsdddS)NrArPrQ)rr{srrr rz=SpecSignatureTest.test_skip_attributeerrors..csjSr)Z nonexistingrrrrrr) r&r%rrrrrrrr$r8)rrrr)rrrtest_skip_attributeerrorssz+SpecSignatureTest.test_skip_attributeerrorscCsGdddt}t|}|t||d|d|jdd|t|jd|dd|dd|jddd|jt|jddddS) Nc@seZdZdddZdS)z3SpecSignatureTest.test_signature_class..FoorQcSrrrrrrr__init__rz.Foo.__init__Nrwrrrrrrrrr5r@r5rArnrPrSrra)r&rrrrrr'rErrrtest_signature_classs     z&SpecSignatureTest.test_signature_classcCsGdddt}t|dS)Nc@r)z6SpecSignatureTest.test_class_with_no_init..FooNrrrrrr5*r@r5)r&r)rr5rrrtest_class_with_no_init'sz)SpecSignatureTest.test_class_with_no_initcCsGdddt}t|}|dd|dd|jddd|t|d|dd}|t||dd|d|jdd|d|d|jddt|dd}|dd|jdd|t||d|ddS)Nc@r0)z;SpecSignatureTest.test_signature_callable..CallablecSrrr)rr|rrrrr1rzDSpecSignatureTest.test_signature_callable..Callable.__init__cSrrrrrrr__call__2rzDSpecSignatureTest.test_signature_callable..Callable.__call__N)rrrrrrrrrCallable0r6rrArPr|rrrn)r&rrrrr')rrr)rrrrtest_signature_callable/s(            z)SpecSignatureTest.test_signature_callablecCsvGdddt}t|}|}||t|d|t||t|dt|}|t||t|ddS)Nc@r>)zASpecSignatureTest.test_signature_noncallable..NonCallablecSrrrrrrrrMrzJSpecSignatureTest.test_signature_noncallable..NonCallable.__init__Nrrrrr NonCallableLr@rr)r&rrrr)rrr)rrrrtest_signature_noncallableKs   z,SpecSignatureTest.test_signature_noncallablecCsDGdddt}t|}|j}||td||jdS)Nc@seZdZdZdS)z8SpecSignatureTest.test_create_autospec_none..FooN)rrrr8rrrrr5]r@r5)r&rr8assertNotIsInstancerr$r)rr5r)Znonerrrtest_create_autospec_none\s z+SpecSignatureTest.test_create_autospec_nonecCsfGdddt}t|}|d|jd|jjdd|jdd|jd|jjdddS)Nc@r>)zMSpecSignatureTest.test_autospec_functions_with_self_in_odd_place..FoocSrrr)rrrrrrjrzOSpecSignatureTest.test_autospec_functions_with_self_in_odd_place..Foo.fNrrrrrr5ir@r5 r)r&rrr')rr5rrrr.test_autospec_functions_with_self_in_odd_placehs    z@SpecSignatureTest.test_autospec_functions_with_self_in_odd_placecsvGdddtGdddtGfdddt}t|}fdd}||j||j||j||jdS) Nc@s&eZdZddZdddZddZdS) zCSpecSignatureTest.test_autospec_data_descriptor..DescriptorcSs ||_dSr)rl)rrlrrrrwrzLSpecSignatureTest.test_autospec_data_descriptor..Descriptor.__init__NcSrrr)rrrrrrrzrzKSpecSignatureTest.test_autospec_data_descriptor..Descriptor.__get__cSrrr)rrrlrrr__set__}rzKSpecSignatureTest.test_autospec_data_descriptor..Descriptor.__set__r)rrrrrrrrrr Descriptorvs rc@r)zCSpecSignatureTest.test_autospec_data_descriptor..MyPropertyNrrrrr MyPropertyr@rcs2eZdZdgZeddZddZdZdS)z.FooslotcSrrrrrrrproprzASpecSignatureTest.test_autospec_data_descriptor..Foo.propcSrrrrrrrsubproprzDSpecSignatureTest.test_autospec_data_descriptor..Foo.subproprN)rrrZ __slots__propertyrrdescr)rrrrr5s   r5csH|t|ddd|ddd|ddd|jddddS)NrArPrQrSrrq)rrZabcr)Z mock_attrrrrcheck_data_descriptors   zNSpecSignatureTest.test_autospec_data_descriptor..check_data_descriptor)r&rrrrrr)rr5r$rr)rrrrtest_autospec_data_descriptorus     z/SpecSignatureTest.test_autospec_data_descriptorcCs\ttjt}||tt|}||||ddd|ddddS)NrSrrq) typesZ MethodTypetimeZctimerr,rrr9)rZmethZmockedrrr'test_autospec_on_bound_builtin_functions z9SpecSignatureTest.test_autospec_on_bound_builtin_functioncCs0Gddd}|}t|}|t|ddS)Nc@r>)zESpecSignatureTest.test_autospec_getattr_partial_function..FoocSstdd|S)NcSrrr)ZnamerrrrrzcSpecSignatureTest.test_autospec_getattr_partial_function..Foo.__getattr__..r )rZ attributerrrrrzQSpecSignatureTest.test_autospec_getattr_partial_function..Foo.__getattr__N)rrrrrrrrr5rr5r)rrhZhasattr)rr5ZproxyZautospecrrr&test_autospec_getattr_partial_functionsz8SpecSignatureTest.test_autospec_getattr_partial_functioncCspdd}t|}|dd|ddd|t|t|||jtddtdddg|t|ddS)NcSrrrrrrrmyfuncrz=SpecSignatureTest.test_spec_inspect_signature..myfuncrArPr)rr%inspect signaturer;rrr)rrr)rrrtest_spec_inspect_signatures   z-SpecSignatureTest.test_spec_inspect_signaturecCsd ddddddd}||dddd d t|}|dddd |ddd |t|t|||jtdddd tddd g|t|d|jt|dddd d dS) Nrrk)rrcZreturncSs |||Srr)rrrrrrr$rzFSpecSignatureTest.test_spec_inspect_signature_annotations..foorArPrQ)rrqrS)r)r%rrrr;rrr)rr$r)rrr'test_spec_inspect_signature_annotationss $z9SpecSignatureTest.test_spec_inspect_signature_annotationscCs"dd}t|}||jddS)NcSsdS)NZnoperrrrrrrz>SpecSignatureTest.test_spec_function_no_name..Zfuncopy)rr%r)rZfuncr)rrrtest_spec_function_no_namerz,SpecSignatureTest.test_spec_function_no_namecCsfdd}t|}|d|tdg|t |tdgWdn1sX0YdS)NcSrrrrnrrrrrz@SpecSignatureTest.test_spec_function_assert_has_calls..frArP)rrCrrrrrrr#test_spec_function_assert_has_callss  z5SpecSignatureTest.test_spec_function_assert_has_callscCsZdd}t|}|d|d|t|dWdn1sL0YdS)NcSrrrrnrrrrrz?SpecSignatureTest.test_spec_function_assert_any_call..frArP)rrDrrrrrr"test_spec_function_assert_any_calls   z4SpecSignatureTest.test_spec_function_assert_any_callcCsvdd}t}t||d}|dd||jtdg||jtdg|||jg||jgdS)NcSrrrrnrrrrrz:SpecSignatureTest.test_spec_function_reset_mock..frrArP)rrr%r;rr9)rrZrvr)rrrtest_spec_function_reset_mocks  z/SpecSignatureTest.test_spec_function_reset_mockN))rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r rrrrr{sL      &  ,     rc@s,eZdZddZddZddZddZd S) TestCallListcCst}||jt|dd|dd|dd|ddtddtddtddtddfD]}|||jq`tddtddg}|||jtddtddg}|||jtddtddg}|||jtddg}|||j|td|j|tdg|jdS) NrArPrQrnrSrqrrt)rrrrrrreZ assertNotIn)rr)rVZcallsrrr!test_args_list_contains_call_lists$    ( z.TestCallList.test_args_list_contains_call_listcCsJt}|dd|jdd|jjdddd}|t|j|dS) NrArPrQrnrtZdog)ZcatzU[call(1, 2), call.foo(a=3), call.foo.bar(), call.foo.bar().baz('fish', cat='dog')])rr$r8rMr%r,r;)rr)r<rrrtest_call_list_strs  zTestCallList.test_call_list_strcCstdttd}|}zftj|t}|j|||j t t gd|_||j t t t dgW| n | 0dS)Nz%s.SomeClass.one)Z new_callablerQ) rrr rrrrr'r%r;rZstop)rrr)rrrrtest_propertymock&szTestCallList.test_propertymockcCs@t}t}|t|_|j}|||t||tdSr)rr rr$rrr)rrrZreturnedrrrtest_propertymock_returnvalue8s  z*TestCallList.test_propertymock_returnvalueN)rrrr r rrrrrrr sr c@r )TestCallablePredicatecCs(ttttttfD]}|t|qdSr)r,ZbytesrkrZtuplerrir )rrrrr test_typeEszTestCallablePredicate.test_typecCs&Gddd}|}|t|dS)Nc@r>)z>TestCallablePredicate.test_call_magic_method..CallablecSrrrrrrrrKrzGTestCallablePredicate.test_call_magic_method..Callable.__call__N)rrrrrrrrrJr@r)rir )rrrrrrtest_call_magic_methodIsz,TestCallablePredicate.test_call_magic_methodcC"Gddd}|t|jdS)Nc@eZdZeddZdS)zATestCallablePredicate.test_staticmethod..WithStaticMethodcSrrrrrrr staticfuncQrzLTestCallablePredicate.test_staticmethod..WithStaticMethod.staticfuncN)rrrrrrrrrWithStaticMethodPr)rir r)rrrrrtest_staticmethodOz'TestCallablePredicate.test_staticmethodcCr)Nc@eZdZedZdS)zMTestCallablePredicate.test_non_callable_staticmethod..BadStaticMethodN)rrrr not_callablerrrrBadStaticMethodVr@rrhr r)rrrrrtest_non_callable_staticmethodUz4TestCallablePredicate.test_non_callable_staticmethodcCr)Nc@r)z?TestCallablePredicate.test_classmethod..WithClassMethodcSrrr)rrrr classfunc\rzITestCallablePredicate.test_classmethod..WithClassMethod.classfuncN)rrrrr rrrrWithClassMethod[rr!)rir r )rr!rrrtest_classmethodZrz&TestCallablePredicate.test_classmethodcCr)Nc@r)zKTestCallablePredicate.test_non_callable_classmethod..BadClassMethodN)rrrrrrrrrBadClassMethodar@r#r)rr#rrrtest_non_callable_classmethod`rz3TestCallablePredicate.test_non_callable_classmethodN) rrrrrrrr"r$rrrrrCs rZ__main__)rrrZunittestZ unittest.mockrrrrrrrrr r r Z functoolsr r&rZTestCaser!rIrr rrZmainrrrrZs*0  E#G#